Documentation
¶
Index ¶
- type ResourceClient
- type SDKEngine
- func (e *SDKEngine) AccessWorldState(ctx context.Context, ref *bucket.ObjectRef, ...) error
- func (e *SDKEngine) BuildStorageCursor(ctx context.Context) (*bucket_lookup.Cursor, error)
- func (e *SDKEngine) GetSeqno(ctx context.Context) (uint64, error)
- func (e *SDKEngine) NewTransaction(ctx context.Context, write bool) (world.Tx, error)
- func (e *SDKEngine) Release()
- func (e *SDKEngine) WaitSeqno(ctx context.Context, value uint64) (uint64, error)
- type SDKObjectIterator
- type SDKObjectState
- func (os *SDKObjectState) AccessWorldState(ctx context.Context, ref *bucket.ObjectRef, ...) error
- func (os *SDKObjectState) ApplyObjectOp(ctx context.Context, op world.Operation, sender peer.ID) (uint64, bool, error)
- func (os *SDKObjectState) GetKey() string
- func (os *SDKObjectState) GetRootRef(ctx context.Context) (*bucket.ObjectRef, uint64, error)
- func (os *SDKObjectState) IncrementRev(ctx context.Context) (uint64, error)
- func (os *SDKObjectState) Release()
- func (os *SDKObjectState) SetRootRef(ctx context.Context, rootRef *bucket.ObjectRef) (uint64, error)
- func (os *SDKObjectState) WaitRev(ctx context.Context, rev uint64, ignoreNotFound bool) (uint64, error)
- type SDKTx
- type SDKWorldState
- func (ws *SDKWorldState) AccessCayleyGraph(ctx context.Context, write bool, ...) error
- func (ws *SDKWorldState) AccessWorldState(ctx context.Context, ref *bucket.ObjectRef, ...) error
- func (ws *SDKWorldState) ApplyWorldOp(ctx context.Context, op world.Operation, sender peer.ID) (uint64, bool, error)
- func (ws *SDKWorldState) BuildStorageCursor(ctx context.Context) (*bucket_lookup.Cursor, error)
- func (ws *SDKWorldState) CreateObject(ctx context.Context, key string, rootRef *bucket.ObjectRef) (world.ObjectState, error)
- func (ws *SDKWorldState) DeleteGraphObject(ctx context.Context, value string) error
- func (ws *SDKWorldState) DeleteGraphQuad(ctx context.Context, q world.GraphQuad) error
- func (ws *SDKWorldState) DeleteObject(ctx context.Context, key string) (bool, error)
- func (ws *SDKWorldState) GetObject(ctx context.Context, key string) (world.ObjectState, bool, error)
- func (ws *SDKWorldState) GetReadOnly() bool
- func (ws *SDKWorldState) GetSeqno(ctx context.Context) (uint64, error)
- func (ws *SDKWorldState) IterateObjects(ctx context.Context, prefix string, reversed bool) world.ObjectIterator
- func (ws *SDKWorldState) ListObjectsWithType(ctx context.Context, typeID string) ([]string, error)
- func (ws *SDKWorldState) LookupGraphQuads(ctx context.Context, filter world.GraphQuad, limit uint32) ([]world.GraphQuad, error)
- func (ws *SDKWorldState) Release()
- func (ws *SDKWorldState) RenameObject(ctx context.Context, oldKey, newKey string, descendants bool) (world.ObjectState, error)
- func (ws *SDKWorldState) SetGraphQuad(ctx context.Context, q world.GraphQuad) error
- func (ws *SDKWorldState) WaitSeqno(ctx context.Context, value uint64) (uint64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResourceClient ¶ added in v0.51.2
type ResourceClient interface {
CreateResourceReference(resourceID uint32) resource_client.ResourceRef
}
ResourceClient creates references for resource IDs returned by world RPCs.
type SDKEngine ¶
type SDKEngine struct {
// contains filtered or unexported fields
}
SDKEngine implements world.Engine over SRPC by delegating to EngineResourceService calls on a remote resource.
func NewSDKEngine ¶
func NewSDKEngine(client ResourceClient, ref resource_client.ResourceRef) (*SDKEngine, error)
NewSDKEngine creates a new SDKEngine wrapping a resource reference.
func (*SDKEngine) AccessWorldState ¶
func (e *SDKEngine) AccessWorldState(ctx context.Context, ref *bucket.ObjectRef, cb func(*bucket_lookup.Cursor) error) error
AccessWorldState builds a bucket lookup cursor with an optional ref.
func (*SDKEngine) BuildStorageCursor ¶
BuildStorageCursor builds a cursor to the world storage with an empty ref.
func (*SDKEngine) NewTransaction ¶
NewTransaction creates a new transaction against the world state. Set write=true if the transaction will perform write operations. Always call Discard() when done with the transaction. Note: Engine might return a read-only transaction even if write=true.
type SDKObjectIterator ¶
type SDKObjectIterator struct {
// contains filtered or unexported fields
}
SDKObjectIterator implements world.ObjectIterator over SRPC by delegating to ObjectIteratorResourceService calls on a remote resource.
SDKObjectIterator functions are NOT thread safe, use from one goroutine at a time.
Note: the world.ObjectIterator interface does not pass context on its methods, but SRPC calls require one. The context from the IterateObjects call is captured and used for all subsequent calls.
func NewSDKObjectIterator ¶
func NewSDKObjectIterator(ctx context.Context, ref resource_client.ResourceRef) (*SDKObjectIterator, error)
NewSDKObjectIterator creates a new SDKObjectIterator wrapping a resource reference. The context is used for all subsequent SRPC calls on the iterator.
func (*SDKObjectIterator) Err ¶
func (it *SDKObjectIterator) Err() error
Err returns any error that has closed the iterator.
func (*SDKObjectIterator) Key ¶
func (it *SDKObjectIterator) Key() string
Key returns the current entry key, or empty string if not valid.
func (*SDKObjectIterator) Next ¶
func (it *SDKObjectIterator) Next() bool
Next advances to the next entry and returns Valid.
func (*SDKObjectIterator) Seek ¶
func (it *SDKObjectIterator) Seek(k string) error
Seek moves the iterator to the first key >= the provided key (or <= in reverse mode). Pass empty string to seek to the beginning (or end if reversed).
func (*SDKObjectIterator) Valid ¶
func (it *SDKObjectIterator) Valid() bool
Valid returns if the iterator points to a valid entry.
type SDKObjectState ¶
type SDKObjectState struct {
// contains filtered or unexported fields
}
SDKObjectState implements world.ObjectState over SRPC by delegating to ObjectStateResourceService calls on a remote resource.
func NewSDKObjectState ¶
func NewSDKObjectState(client ResourceClient, ref resource_client.ResourceRef, objectKey string) (*SDKObjectState, error)
NewSDKObjectState creates a new SDKObjectState wrapping a resource reference.
func (*SDKObjectState) AccessWorldState ¶
func (os *SDKObjectState) AccessWorldState(ctx context.Context, ref *bucket.ObjectRef, cb func(*bucket_lookup.Cursor) error) error
AccessWorldState builds a bucket lookup cursor with an optional ref.
func (*SDKObjectState) ApplyObjectOp ¶
func (os *SDKObjectState) ApplyObjectOp(ctx context.Context, op world.Operation, sender peer.ID) (uint64, bool, error)
ApplyObjectOp applies a batch operation at the object level. Returns rev, sysErr, err.
func (*SDKObjectState) GetKey ¶
func (os *SDKObjectState) GetKey() string
GetKey returns the key this state object is for.
func (*SDKObjectState) GetRootRef ¶
GetRootRef returns the root reference and current revision number.
func (*SDKObjectState) IncrementRev ¶
func (os *SDKObjectState) IncrementRev(ctx context.Context) (uint64, error)
IncrementRev increments the revision of the object. Returns revision just after the change was applied.
func (*SDKObjectState) Release ¶
func (os *SDKObjectState) Release()
Release releases the underlying resource reference.
func (*SDKObjectState) SetRootRef ¶
func (os *SDKObjectState) SetRootRef(ctx context.Context, rootRef *bucket.ObjectRef) (uint64, error)
SetRootRef changes the root reference of the object. Increments the revision of the object if changed. Returns revision just after the change was applied.
func (*SDKObjectState) WaitRev ¶
func (os *SDKObjectState) WaitRev(ctx context.Context, rev uint64, ignoreNotFound bool) (uint64, error)
WaitRev waits until the object rev is >= the specified. Returns ErrObjectNotFound if the object is deleted. If ignoreNotFound is set, waits for the object to exist. Returns the new rev.
type SDKTx ¶
type SDKTx struct {
*SDKWorldState
// contains filtered or unexported fields
}
SDKTx implements world.Tx over SRPC by delegating to TxResourceService and WorldStateResourceService calls.
func NewSDKTx ¶
func NewSDKTx(client ResourceClient, ref resource_client.ResourceRef, readOnly bool) (*SDKTx, error)
NewSDKTx creates a new SDKTx wrapping a resource reference. The reference must point to a TxResource on the server.
type SDKWorldState ¶
type SDKWorldState struct {
// contains filtered or unexported fields
}
SDKWorldState implements world.WorldState over SRPC by delegating to WorldStateResourceService calls on a remote resource.
func NewSDKWorldState ¶
func NewSDKWorldState(client ResourceClient, ref resource_client.ResourceRef, readOnly bool) (*SDKWorldState, error)
NewSDKWorldState creates a new SDKWorldState wrapping a resource reference.
func (*SDKWorldState) AccessCayleyGraph ¶
func (ws *SDKWorldState) AccessCayleyGraph(ctx context.Context, write bool, cb func(ctx context.Context, h world.CayleyHandle) error) error
AccessCayleyGraph calls a callback with a temporary Cayley graph handle.
func (*SDKWorldState) AccessWorldState ¶
func (ws *SDKWorldState) AccessWorldState(ctx context.Context, ref *bucket.ObjectRef, cb func(*bucket_lookup.Cursor) error) error
AccessWorldState builds a bucket lookup cursor with an optional ref.
func (*SDKWorldState) ApplyWorldOp ¶
func (ws *SDKWorldState) ApplyWorldOp(ctx context.Context, op world.Operation, sender peer.ID) (uint64, bool, error)
ApplyWorldOp applies a batch operation at the world level. The handling of the operation is operation-type specific. Returns seqno, sysErr, err.
func (*SDKWorldState) BuildStorageCursor ¶
func (ws *SDKWorldState) BuildStorageCursor(ctx context.Context) (*bucket_lookup.Cursor, error)
BuildStorageCursor builds a cursor to the world storage with an empty ref.
func (*SDKWorldState) CreateObject ¶
func (ws *SDKWorldState) CreateObject(ctx context.Context, key string, rootRef *bucket.ObjectRef) (world.ObjectState, error)
CreateObject creates an object with a key and initial root ref. Returns ErrObjectExists if the object already exists.
func (*SDKWorldState) DeleteGraphObject ¶
func (ws *SDKWorldState) DeleteGraphObject(ctx context.Context, value string) error
DeleteGraphObject deletes all quads with Subject or Object set to value.
func (*SDKWorldState) DeleteGraphQuad ¶
DeleteGraphQuad deletes a quad from the graph store.
func (*SDKWorldState) DeleteObject ¶
DeleteObject deletes an object and associated graph quads by ID. Returns false, nil if not found.
func (*SDKWorldState) GetObject ¶
func (ws *SDKWorldState) GetObject(ctx context.Context, key string) (world.ObjectState, bool, error)
GetObject looks up an object by key. Returns nil, false if not found.
func (*SDKWorldState) GetReadOnly ¶
func (ws *SDKWorldState) GetReadOnly() bool
GetReadOnly returns if the state is read-only.
func (*SDKWorldState) GetSeqno ¶
func (ws *SDKWorldState) GetSeqno(ctx context.Context) (uint64, error)
GetSeqno returns the current sequence number of the world state.
func (*SDKWorldState) IterateObjects ¶
func (ws *SDKWorldState) IterateObjects(ctx context.Context, prefix string, reversed bool) world.ObjectIterator
IterateObjects returns an iterator with the given object key prefix. The prefix is NOT clipped from the output keys. Keys are returned in sorted order. Must call Next() or Seek() before valid. Call Close when done with the iterator.
func (*SDKWorldState) ListObjectsWithType ¶
ListObjectsWithType lists object keys with the given type identifier.
func (*SDKWorldState) LookupGraphQuads ¶
func (ws *SDKWorldState) LookupGraphQuads(ctx context.Context, filter world.GraphQuad, limit uint32) ([]world.GraphQuad, error)
LookupGraphQuads searches for graph quads in the store.
func (*SDKWorldState) Release ¶
func (ws *SDKWorldState) Release()
Release releases the underlying resource reference.
func (*SDKWorldState) RenameObject ¶
func (ws *SDKWorldState) RenameObject(ctx context.Context, oldKey, newKey string, descendants bool) (world.ObjectState, error)
RenameObject renames an object key and updates associated graph quads.
func (*SDKWorldState) SetGraphQuad ¶
SetGraphQuad sets a quad in the graph store.