Merge pull request #257 from alecgrieser/cherrypick-docs-and-go-install-fixes
Cherrypick docs and go install fixes
This commit is contained in:
commit
816cceae09
|
@ -167,7 +167,7 @@ else
|
||||||
|
|
||||||
if [[ "${status}" -eq 0 ]] ; then
|
if [[ "${status}" -eq 0 ]] ; then
|
||||||
destdir=$( cd "${destdir}" && pwd ) # Get absolute path of destination dir.
|
destdir=$( cd "${destdir}" && pwd ) # Get absolute path of destination dir.
|
||||||
fdbdir="${destdir}/foundation"
|
fdbdir="${destdir}/foundationdb"
|
||||||
|
|
||||||
if [[ ! -d "${destdir}" ]] ; then
|
if [[ ! -d "${destdir}" ]] ; then
|
||||||
cmd=("mkdir" "-p" "${destdir}")
|
cmd=("mkdir" "-p" "${destdir}")
|
||||||
|
|
|
@ -394,8 +394,8 @@ Transactional decoration
|
||||||
|
|
||||||
@fdb.transactional
|
@fdb.transactional
|
||||||
def simple_function(tr, x, y):
|
def simple_function(tr, x, y):
|
||||||
tr['foo'] = x
|
tr[b'foo'] = x
|
||||||
tr['bar'] = y
|
tr[b'bar'] = y
|
||||||
|
|
||||||
The ``@fdb.transactional`` decorator makes ``simple_function`` a transactional function. All functions using this decorator must have an argument **named** ``tr``. This specially named argument is passed a transaction that the function can use to do reads and writes.
|
The ``@fdb.transactional`` decorator makes ``simple_function`` a transactional function. All functions using this decorator must have an argument **named** ``tr``. This specially named argument is passed a transaction that the function can use to do reads and writes.
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ Asynchronous methods return one of the following subclasses of :class:`Future`:
|
||||||
|
|
||||||
@fdb.transactional
|
@fdb.transactional
|
||||||
def foo(tr):
|
def foo(tr):
|
||||||
val = tr['foo']
|
val = tr[b'foo']
|
||||||
if val.present():
|
if val.present():
|
||||||
print 'Got value: %s' % val
|
print 'Got value: %s' % val
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -38,11 +38,11 @@ Next, we open a FoundationDB database. The API will connect to the FoundationDB
|
||||||
|
|
||||||
We are ready to use the database. In Python, using the ``[]`` operator on the db object is a convenient syntax for performing a read or write on the database. First, let's simply write a key-value pair:
|
We are ready to use the database. In Python, using the ``[]`` operator on the db object is a convenient syntax for performing a read or write on the database. First, let's simply write a key-value pair:
|
||||||
|
|
||||||
>>> db['hello'] = 'world'
|
>>> db[b'hello'] = b'world'
|
||||||
|
|
||||||
When this command returns without exception, the modification is durably stored in FoundationDB! Under the covers, this function creates a transaction with a single modification. We'll see later how to do multiple operations in a single transaction. For now, let's read back the data::
|
When this command returns without exception, the modification is durably stored in FoundationDB! Under the covers, this function creates a transaction with a single modification. We'll see later how to do multiple operations in a single transaction. For now, let's read back the data::
|
||||||
|
|
||||||
>>> print 'hello', db['hello']
|
>>> print 'hello', db[b'hello']
|
||||||
hello world
|
hello world
|
||||||
|
|
||||||
If this is all working, it looks like we are ready to start building a real application. For reference, here's the full code for "hello world"::
|
If this is all working, it looks like we are ready to start building a real application. For reference, here's the full code for "hello world"::
|
||||||
|
@ -50,8 +50,8 @@ If this is all working, it looks like we are ready to start building a real appl
|
||||||
import fdb
|
import fdb
|
||||||
fdb.api_version(510)
|
fdb.api_version(510)
|
||||||
db = fdb.open()
|
db = fdb.open()
|
||||||
db['hello'] = 'world'
|
db[b'hello'] = b'world'
|
||||||
print 'hello', db['hello']
|
print 'hello', db[b'hello']
|
||||||
|
|
||||||
Class scheduling application
|
Class scheduling application
|
||||||
============================
|
============================
|
||||||
|
|
Loading…
Reference in New Issue