| |
- OIDStore(object)
-
- BisectOIDStore
class BisectOIDStore(OIDStore) |
|
In-memory OIDStore based on the standard bisect module
This OID store is for use primarily in testing situations,
where a small OID set is to be loaded and tested against.
It should be available on any Python installation.
This is the only storage which allows for chaining
storages (i.e. inserting a storage as a child of a
storage) and run-time-calculated values (inserting
a callable object which calculates values on
retrieval).
Signature for a callable value is:
def callableValue( oid, storage ):
return finalValue |
|
- Method resolution order:
- BisectOIDStore
- OIDStore
- object
Methods defined here:
- __init__(self, OIDs=None)
- Initialise the storage with appropriate OIDs
- firstOID(self)
- Retrieve the first OID,value pair for the storage
Raises OIDNameError if there are no pairs available
- getExactOID(self, base)
- Get the given OID,value pair for the given base
This method is responsible for implementing the GET
request, (or a GETBULK request which specifies
inclusive operation).
- nextOID(self, base)
- Get next OID,value pair after given base OID
This method is responsible for implementing GETNEXT,
and GETBULK requests.
- returnValue(self, value, oid)
- Return value, or value.calculateOIDValue( oid, self )
- setValue(self, oid, value)
- Set the given oid,value pair, returning old value
This method is responsible for implementing the SET
request.
Methods inherited from OIDStore:
- __iter__(self)
- Create an iterator object for this OIDStore
- close(self)
- Close the OIDStore
- update(self, valueSet)
- Given a valueSet, load given values into storage
valueSet -- A set of OID:value mappings in these forms
{ rootOID : { oid : value }}
OIDStore instance -- iterable as a (key,value) producing sequence
[ (oid,value) ] # value can also be a dictionary or OIDStore (as seen above)
[ dict, OIDStore, ... ] # i.e. just a sequence of dicts or storages
XXX Should allow for passing in another OIDStore, but that
Will require a first() method for all OIDStores
- validateSetValue(self, oid, value, request, address, implementation)
- Validate that given oid & value can be set
returns 0 on success, returns errorID on failure
This implementation just returns 0 in all cases
Data and other attributes inherited from OIDStore:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'OIDStore' objects>
- list of weak references to the object (if defined)
| |