sdk_world_engine

package
v0.53.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRemoteCayleyGraphUnsupported = errors.New("remote Cayley graph access is unsupported; use bounded graph RPCs")

ErrRemoteCayleyGraphUnsupported is returned when a remote SDK world is asked for a local Cayley handle.

Functions

This section is empty.

Types

type AttachedResourceClient added in v0.51.7

type AttachedResourceClient struct {
	// contains filtered or unexported fields
}

AttachedResourceClient creates resource refs for resources attached to the current resource request.

func NewAttachedResourceClient added in v0.51.7

func NewAttachedResourceClient(resourceCtx resource_server.ResourceClientContext) *AttachedResourceClient

NewAttachedResourceClient constructs an AttachedResourceClient.

func (*AttachedResourceClient) CreateResourceReference added in v0.51.7

func (c *AttachedResourceClient) CreateResourceReference(resourceID uint32) resource_client.ResourceRef

CreateResourceReference creates a reference to an attached resource.

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 NewAttachedEngine added in v0.51.7

func NewAttachedEngine(ctx context.Context, resourceID uint32) (*SDKEngine, error)

NewAttachedEngine constructs an SDKEngine from an attached world engine resource id.

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

func (e *SDKEngine) BuildStorageCursor(ctx context.Context) (*bucket_lookup.Cursor, error)

BuildStorageCursor builds a cursor to the world storage with an empty ref.

func (*SDKEngine) GetSeqno

func (e *SDKEngine) GetSeqno(ctx context.Context) (uint64, error)

GetSeqno returns the current sequence number of the world state.

func (*SDKEngine) GetWorldRootSnapshot added in v0.51.7

func (e *SDKEngine) GetWorldRootSnapshot(ctx context.Context) (*s4wave_world.WorldRootSnapshot, error)

GetWorldRootSnapshot returns the current committed World root snapshot.

func (*SDKEngine) NewTransaction

func (e *SDKEngine) NewTransaction(ctx context.Context, write bool) (world.Tx, error)

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.

func (*SDKEngine) Release

func (e *SDKEngine) Release()

Release releases the underlying resource reference.

func (*SDKEngine) Sync added in v0.52.0

func (e *SDKEngine) Sync(ctx context.Context) (bool, error)

Sync fences durable storage and advances the durable head via the engine.

func (*SDKEngine) WaitSeqno

func (e *SDKEngine) WaitSeqno(ctx context.Context, value uint64) (uint64, error)

WaitSeqno waits for the world state sequence number to reach or exceed the specified value.

func (*SDKEngine) WatchWorldRootSnapshots added in v0.51.7

WatchWorldRootSnapshots streams committed World root snapshots.

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) Close

func (it *SDKObjectIterator) Close()

Close releases 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

func (os *SDKObjectState) GetRootRef(ctx context.Context) (*bucket.ObjectRef, uint64, error)

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.

func (*SDKTx) Commit

func (tx *SDKTx) Commit(ctx context.Context) error

Commit commits the transaction to storage.

func (*SDKTx) Discard

func (tx *SDKTx) Discard()

Discard cancels the transaction. If called after Commit, does nothing.

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 rejects local Cayley handle access for remote worlds.

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

func (ws *SDKWorldState) DeleteGraphQuad(ctx context.Context, q world.GraphQuad) error

DeleteGraphQuad deletes a quad from the graph store.

func (*SDKWorldState) DeleteObject

func (ws *SDKWorldState) DeleteObject(ctx context.Context, key string) (bool, error)

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) GetObjectMetadataBatch added in v0.51.6

func (ws *SDKWorldState) GetObjectMetadataBatch(ctx context.Context, keys []string) ([]*world_types.ObjectMetadata, error)

GetObjectMetadataBatch returns graph metadata for object keys.

func (*SDKWorldState) GetObjectRootRefsBatch added in v0.51.7

func (ws *SDKWorldState) GetObjectRootRefsBatch(ctx context.Context, keys []string) ([]*world.ObjectRootRef, error)

GetObjectRootRefsBatch returns root references for object keys.

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) HasObject added in v0.53.0

func (ws *SDKWorldState) HasObject(ctx context.Context, key string) (bool, error)

HasObject reports whether an object exists at key. The client keeps no transaction-local knowledge, so it queries the remote resource directly.

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) ListGraphEdgeBuckets added in v0.51.7

func (ws *SDKWorldState) ListGraphEdgeBuckets(ctx context.Context, query *world.GraphEdgeBucketQuery) ([]*world.GraphEdgeBucket, error)

ListGraphEdgeBuckets lists grouped inbound/outbound graph edge buckets.

func (*SDKWorldState) ListObjectsWithType

func (ws *SDKWorldState) ListObjectsWithType(ctx context.Context, typeID string) ([]string, error)

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) LookupGraphQuadsBatch added in v0.51.6

func (ws *SDKWorldState) LookupGraphQuadsBatch(ctx context.Context, filters []world.GraphQuad, limitPerFilter uint32) ([][]world.GraphQuad, error)

LookupGraphQuadsBatch searches for graph quads using bounded indexed filters.

func (*SDKWorldState) QueryGraphPath added in v0.51.6

func (ws *SDKWorldState) QueryGraphPath(ctx context.Context, query *world.GraphPathQuery) (*world.GraphPathQueryResult, error)

QueryGraphPath executes a bounded server-side graph path query.

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

func (ws *SDKWorldState) SetGraphQuad(ctx context.Context, q world.GraphQuad) error

SetGraphQuad sets a quad in the graph store.

func (*SDKWorldState) Sync added in v0.52.0

func (ws *SDKWorldState) Sync(ctx context.Context) (bool, error)

Sync fences the block writes made through this world state durable.

func (*SDKWorldState) WaitSeqno

func (ws *SDKWorldState) WaitSeqno(ctx context.Context, value uint64) (uint64, error)

WaitSeqno waits for the world state sequence number to reach or exceed the specified value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL