Module scalaris :: Class TransactionSingleOp
[hide private]
[frames] | no frames]

Class TransactionSingleOp

source code


Single write or read operations on scalaris.

Instance Methods [hide private]
 
__init__(self, conn=None)
Create a new object using the given connection
source code
 
new_req_list(self, other=None)
Returns a new ReqList object allowing multiple parallel requests.
source code
 
req_list(self, reqlist)
Issues multiple parallel requests to scalaris; each will be committed.
source code
 
process_result_read(self, result)
Processes a result element from the list returned by req_list() which originated from a read operation.
source code
 
process_result_write(self, result)
Processes a result element from the list returned by req_list() which originated from a write operation.
source code
 
process_result_add_del_on_list(self, result)
Processes a result element from the list returned by req_list() which originated from a add_del_on_list operation.
source code
 
process_result_add_on_nr(self, result)
Processes a result element from the list returned by req_list() which originated from a add_on_nr operation.
source code
 
process_result_test_and_set(self, result)
Processes a result element from the list returned by req_list() which originated from a test_and_set operation.
source code
 
read(self, key)
Read the value at key.
source code
 
write(self, key, value)
Write the value to key.
source code
 
add_del_on_list(self, key, to_add, to_remove)
Changes the list stored at the given key, i.e.
source code
 
add_on_nr(self, key, to_add)
Changes the number stored at the given key, i.e.
source code
 
test_and_set(self, key, old_value, new_value)
Atomic test and set, i.e.
source code
 
nop(self, value)
No operation (may be used for measuring the JSON overhead).
source code
 
close_connection(self)
Close the connection to scalaris (it will automatically be re-opened on the next request).
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, conn=None)
(Constructor)

source code 

Create a new object using the given connection

Overrides: object.__init__

req_list(self, reqlist)

source code 

Issues multiple parallel requests to scalaris; each will be committed. NOTE: The execution order of multiple requests on the same key is undefined! Request lists can be created using new_req_list(). The returned list has the following form: [{'status': 'ok'} or {'status': 'ok', 'value': xxx} or {'status': 'fail', 'reason': 'timeout' or 'abort' or 'not_found'}]. Elements of this list can be processed with process_result_read() and process_result_write().

process_result_read(self, result)

source code 

Processes a result element from the list returned by req_list() which originated from a read operation. Returns the read value on success. Raises the appropriate exceptions if a failure occurred during the operation. Beware: lists of (small) integers may be (falsely) returned as a string - use str_to_list() to convert such strings.

process_result_write(self, result)

source code 

Processes a result element from the list returned by req_list() which originated from a write operation. Raises the appropriate exceptions if a failure occurred during the operation.

process_result_add_del_on_list(self, result)

source code 

Processes a result element from the list returned by req_list() which originated from a add_del_on_list operation. Raises the appropriate exceptions if a failure occurred during the operation.

process_result_add_on_nr(self, result)

source code 

Processes a result element from the list returned by req_list() which originated from a add_on_nr operation. Raises the appropriate exceptions if a failure occurred during the operation.

process_result_test_and_set(self, result)

source code 

Processes a result element from the list returned by req_list() which originated from a test_and_set operation. Raises the appropriate exceptions if a failure occurred during the operation.

read(self, key)

source code 

Read the value at key. Beware: lists of (small) integers may be (falsely) returned as a string - use str_to_list() to convert such strings.

add_del_on_list(self, key, to_add, to_remove)

source code 

Changes the list stored at the given key, i.e. first adds all items in to_add then removes all items in to_remove. Both, to_add and to_remove, must be lists. Assumes en empty list if no value exists at key.

add_on_nr(self, key, to_add)

source code 

Changes the number stored at the given key, i.e. adds some value. Assumes 0 if no value exists at key.

test_and_set(self, key, old_value, new_value)

source code 

Atomic test and set, i.e. if the old value at key is old_value, then write new_value.