Documentation
¶
Index ¶
- Variables
- type CreateEdgeOptions
- type CreateNodeOptions
- type DB
- func (db *DB) Begin(readOnly bool) (*Tx, error)
- func (db *DB) BeginSnapshot() (*Snapshot, error)
- func (db *DB) BeginWriteContext(ctx context.Context) (*Tx, error)
- func (db *DB) CacheClear() error
- func (db *DB) CacheStats() (QueryCacheStats, error)
- func (db *DB) Changes(afterSequence uint64, limit uint, timeoutMS uint32) ([]StreamRecord, error)
- func (db *DB) ChangesContext(ctx context.Context, afterSequence uint64, opts StreamReadOptions) (StreamReadResult, error)
- func (db *DB) Checkpoint() error
- func (db *DB) CheckpointContext(ctx context.Context) error
- func (db *DB) Close() error
- func (db *DB) CloseContext(ctx context.Context) error
- func (db *DB) CreateEdgePropertyIndex(edgeType, property string) error
- func (db *DB) CreateEdgePropertyIndexContext(ctx context.Context, edgeType, property string) error
- func (db *DB) CreateNodePropertyIndex(label, property string) error
- func (db *DB) CreateNodePropertyIndexContext(ctx context.Context, label, property string) error
- func (db *DB) DropEdgePropertyIndex(edgeType, property string) error
- func (db *DB) DropNodePropertyIndex(label, property string) error
- func (db *DB) FTSSearch(query string, opts FTSSearchOptions) ([]FTSSearchResult, error)
- func (db *DB) FTSSearchContext(ctx context.Context, query string, opts FTSSearchOptions) ([]FTSSearchResult, error)
- func (db *DB) GenerationRetentionStats() (GenerationRetentionStats, error)
- func (db *DB) GetNodesByLabel(label string) ([]uint64, error)
- func (db *DB) GetStreamOffset(stream, consumer string) (uint64, bool, error)
- func (db *DB) IsOpen() bool
- func (db *DB) Query(query string, params map[string]any) (QueryResult, error)
- func (db *DB) QueryContext(ctx context.Context, query string, params map[string]any, opts QueryOptions) (QueryResult, error)
- func (db *DB) ReadStream(stream string, afterSequence uint64, limit uint, timeoutMS uint32) ([]StreamRecord, error)
- func (db *DB) ReadStreamContext(ctx context.Context, stream string, afterSequence uint64, ...) (StreamReadResult, error)
- func (db *DB) RebuildVectorIndexContext(ctx context.Context) error
- func (db *DB) Serialize() ([]byte, error)
- func (db *DB) SnapshotGraph() (*store.GraphState, *GenerationLease, error)
- func (db *DB) Update(fn func(*Tx) error) error
- func (db *DB) UpdateContext(ctx context.Context, fn func(*Tx) error) error
- func (db *DB) VectorIndexStats() (VectorIndexStats, error)
- func (db *DB) VectorSearch(vector []float32, opts VectorSearchOptions) ([]VectorSearchResult, error)
- func (db *DB) VectorSearchContext(ctx context.Context, vector []float32, opts VectorSearchOptions) ([]VectorSearchResult, error)
- func (db *DB) View(fn func(*Tx) error) error
- type DurabilityMode
- type Edge
- type FTSSearchOptions
- type FTSSearchResult
- type GenerationLease
- type GenerationRetentionStats
- type Node
- type OpenOptions
- type QueryCacheStats
- type QueryError
- type QueryErrorStage
- type QueryOptions
- type QueryResult
- type Snapshot
- type StreamReadOptions
- type StreamReadResult
- type StreamRecord
- type Tx
- func (tx *Tx) BatchInsert(label string, vectors [][]float32) ([]uint64, error)deprecated
- func (tx *Tx) BatchInsertVectors(label string, vectors [][]float32) ([]uint64, error)
- func (tx *Tx) Commit() error
- func (tx *Tx) CommitContext(ctx context.Context) error
- func (tx *Tx) CreateEdge(sourceID uint64, targetID uint64, edgeType string, opts CreateEdgeOptions) (Edge, error)
- func (tx *Tx) CreateNode(opts CreateNodeOptions) (Node, error)
- func (tx *Tx) DeleteAppMetadata(key []byte) error
- func (tx *Tx) DeleteEdge(sourceID, targetID uint64, edgeType string) error
- func (tx *Tx) DeleteNode(nodeID uint64) error
- func (tx *Tx) FTSIndex(nodeID uint64, text string) error
- func (tx *Tx) FTSIndexContext(ctx context.Context, nodeID uint64, text string) error
- func (tx *Tx) FindEdgesByTypeProperty(edgeType, property string, value any, limit uint) ([]uint64, error)
- func (tx *Tx) FindNodesByLabelProperty(label, property string, value any, limit uint) ([]uint64, error)
- func (tx *Tx) GetAppMetadata(key []byte) ([]byte, bool, error)
- func (tx *Tx) GetEdgeProperty(edgeID uint64, key string) (any, bool, error)
- func (tx *Tx) GetIncomingEdges(nodeID uint64) ([]Edge, error)
- func (tx *Tx) GetIncomingEdgesByType(nodeID uint64, edgeType string, limit uint) ([]Edge, error)
- func (tx *Tx) GetNode(nodeID uint64) (*Node, error)
- func (tx *Tx) GetNodeValue(nodeID uint64) (Node, bool, error)
- func (tx *Tx) GetOutgoingEdges(nodeID uint64) ([]Edge, error)
- func (tx *Tx) GetOutgoingEdgesByType(nodeID uint64, edgeType string, limit uint) ([]Edge, error)
- func (tx *Tx) GetProperty(nodeID uint64, key string) (any, bool, error)
- func (tx *Tx) IsActive() bool
- func (tx *Tx) IsReadOnly() bool
- func (tx *Tx) NodeExists(nodeID uint64) (bool, error)
- func (tx *Tx) PublishStream(stream, kind string, payload any) error
- func (tx *Tx) PublishStreamGetSequence(stream, kind string, payload any) (uint64, error)
- func (tx *Tx) PutAppMetadata(key, value []byte) error
- func (tx *Tx) Query(query string, params map[string]any) (QueryResult, error)
- func (tx *Tx) QueryContext(ctx context.Context, query string, params map[string]any, opts QueryOptions) (QueryResult, error)
- func (tx *Tx) RemoveEdgeProperty(edgeID uint64, key string) error
- func (tx *Tx) Rollback() error
- func (tx *Tx) SetEdgeProperty(edgeID uint64, key string, value any) error
- func (tx *Tx) SetProperty(nodeID uint64, key string, value any) error
- func (tx *Tx) SetStreamOffset(stream, consumer string, sequence uint64) error
- func (tx *Tx) SetVector(nodeID uint64, key string, vector []float32) error
- func (tx *Tx) TrimStream(stream string, beforeSequence uint64) error
- type VectorIndexMode
- type VectorIndexStats
- type VectorSearchOptions
- type VectorSearchResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrReadOnly = errors.New("database is read-only") ErrWriteTxActive = errors.New("write transaction is already active") ErrManagedTransaction = errors.New("managed transaction cannot be completed directly") ErrInactiveTx = errors.New("transaction is inactive") ErrDatabaseClosed = errors.New("database is closed") ErrTransactionsActive = errors.New("database has active transactions") ErrSnapshotActive = errors.New("database has an active snapshot") ErrWriteConflict = errors.New("write transaction conflicts with current commit") ErrRecoveryRequired = errors.New("database requires close and recovery") ErrResourceLimit = errors.New("resource limit exceeded") ErrAlreadyExists = errors.New("already exists") ErrInvalidArgument = errors.New("invalid argument") ErrVectorIndexMaintenanceRequired = errors.New("vector index maintenance required") ErrUnsupportedOption = errors.New("unsupported option") ErrCommitOutcomeUnknown = store.ErrCommitOutcomeUnknown )
var ( ErrDatabaseLocked = errors.New("database is locked") ErrDatabaseLayoutConflict = errors.New("database layout conflicts with existing owner") )
Functions ¶
This section is empty.
Types ¶
type CreateEdgeOptions ¶
type CreateNodeOptions ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func Deserialize ¶
func Deserialize(data []byte, opts OpenOptions) (*DB, error)
Deserialize opens a database from bytes returned by Serialize.
func OpenContext ¶
func (*DB) BeginSnapshot ¶
func (*DB) BeginWriteContext ¶ added in v0.5.0
BeginWriteContext waits for the single writer slot until ctx is canceled. Begin(false) remains the nonblocking compatibility API.
func (*DB) CacheClear ¶
func (*DB) CacheStats ¶
func (db *DB) CacheStats() (QueryCacheStats, error)
func (*DB) ChangesContext ¶ added in v0.3.0
func (db *DB) ChangesContext(ctx context.Context, afterSequence uint64, opts StreamReadOptions) (StreamReadResult, error)
func (*DB) Checkpoint ¶
func (*DB) CheckpointContext ¶ added in v0.5.0
CheckpointContext waits for the writer slot until ctx is canceled. The existing Checkpoint method remains nonblocking for compatibility.
func (*DB) CloseContext ¶ added in v0.5.0
CloseContext waits for the writer slot until ctx is canceled. After the closed transition, teardown is deliberately noncancelable.
func (*DB) CreateEdgePropertyIndex ¶
func (*DB) CreateEdgePropertyIndexContext ¶ added in v0.5.0
func (*DB) CreateNodePropertyIndex ¶
func (*DB) CreateNodePropertyIndexContext ¶ added in v0.5.0
func (*DB) DropEdgePropertyIndex ¶
func (*DB) DropNodePropertyIndex ¶
func (*DB) FTSSearch ¶
func (db *DB) FTSSearch(query string, opts FTSSearchOptions) ([]FTSSearchResult, error)
func (*DB) FTSSearchContext ¶
func (db *DB) FTSSearchContext(ctx context.Context, query string, opts FTSSearchOptions) ([]FTSSearchResult, error)
func (*DB) GenerationRetentionStats ¶ added in v0.5.0
func (db *DB) GenerationRetentionStats() (GenerationRetentionStats, error)
func (*DB) GetStreamOffset ¶
func (*DB) QueryContext ¶
func (db *DB) QueryContext(ctx context.Context, query string, params map[string]any, opts QueryOptions) (QueryResult, error)
func (*DB) ReadStream ¶
func (*DB) ReadStreamContext ¶ added in v0.3.0
func (db *DB) ReadStreamContext(ctx context.Context, stream string, afterSequence uint64, opts StreamReadOptions) (StreamReadResult, error)
ReadStreamContext reads stream records until a record is available, the byte budget is reached, or ctx is canceled. A zero MaxBytes disables the byte limit.
func (*DB) RebuildVectorIndexContext ¶
func (*DB) Serialize ¶
Serialize returns a standalone database file. Writing the bytes to a regular file produces a path that Open can read and update.
func (*DB) SnapshotGraph ¶
func (db *DB) SnapshotGraph() (*store.GraphState, *GenerationLease, error)
func (*DB) UpdateContext ¶
func (*DB) VectorIndexStats ¶
func (db *DB) VectorIndexStats() (VectorIndexStats, error)
func (*DB) VectorSearch ¶
func (db *DB) VectorSearch(vector []float32, opts VectorSearchOptions) ([]VectorSearchResult, error)
func (*DB) VectorSearchContext ¶
func (db *DB) VectorSearchContext(ctx context.Context, vector []float32, opts VectorSearchOptions) ([]VectorSearchResult, error)
type DurabilityMode ¶
type DurabilityMode uint8
const ( DurabilityStandard DurabilityMode = iota DurabilityFull )
type FTSSearchOptions ¶
type FTSSearchResult ¶
type GenerationLease ¶ added in v0.5.0
type GenerationLease struct {
// contains filtered or unexported fields
}
GenerationLease pins a graph generation until Release. It is used by read transactions, snapshots, and exports; callers must release it exactly once.
func (*GenerationLease) Release ¶ added in v0.5.0
func (lease *GenerationLease) Release()
Release releases this generation pin. It is idempotent.
type GenerationRetentionStats ¶ added in v0.5.0
type OpenOptions ¶
type OpenOptions struct {
Create bool
ReadOnly bool
DisableLock bool
CacheSizeMB uint32
PageSize uint32
EnableVector bool
VectorIndexMode VectorIndexMode
VectorDimensions uint16
Durability DurabilityMode
WALCheckpointThresholdBytes uint64
ChangefeedMaxBytes uint64
MaxDatabaseSnapshotBytes uint64
RecoveryMaxDecodedBytes uint64
RecoveryMaxFrames uint64
RecoveryMaxWork uint64
VectorIndexBuildMaxWork uint64
VectorIndexBuildMaxLogicalBytes uint64
DerivedIndexBuildMaxWork uint64
DerivedIndexBuildMaxLogicalBytes uint64
MaxGenerationLeases uint64
MaxRetainedGenerationLogicalBytes uint64
// contains filtered or unexported fields
}
type QueryCacheStats ¶
type QueryError ¶
type QueryError struct {
Stage QueryErrorStage
Err error
}
func (*QueryError) Error ¶
func (e *QueryError) Error() string
func (*QueryError) Unwrap ¶
func (e *QueryError) Unwrap() error
type QueryErrorStage ¶
type QueryErrorStage uint8
const ( QueryErrorStageParse QueryErrorStage = iota + 1 QueryErrorStageExecution )
type QueryOptions ¶
type QueryResult ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot pins one committed database generation while writers continue.
type StreamReadOptions ¶ added in v0.3.0
type StreamReadResult ¶ added in v0.3.0
type StreamReadResult struct {
Records []StreamRecord
LastSequence uint64
ByteLimited bool
}
type StreamRecord ¶
type StreamRecord = store.StreamRecord
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
func (*Tx) BatchInsertVectors ¶
BatchInsertVectors inserts vector-bearing nodes with label. Vectors are stored in the "vector" property for compatibility with the public API.
func (*Tx) CreateEdge ¶
func (*Tx) CreateNode ¶
func (tx *Tx) CreateNode(opts CreateNodeOptions) (Node, error)
func (*Tx) DeleteAppMetadata ¶
func (*Tx) DeleteNode ¶
func (*Tx) FTSIndexContext ¶
func (*Tx) FindEdgesByTypeProperty ¶
func (*Tx) FindNodesByLabelProperty ¶
func (*Tx) GetEdgeProperty ¶
func (*Tx) GetIncomingEdgesByType ¶
func (*Tx) GetOutgoingEdgesByType ¶
func (*Tx) IsReadOnly ¶
func (*Tx) PublishStreamGetSequence ¶
func (*Tx) PutAppMetadata ¶
func (*Tx) QueryContext ¶
func (tx *Tx) QueryContext(ctx context.Context, query string, params map[string]any, opts QueryOptions) (QueryResult, error)
func (*Tx) SetEdgeProperty ¶
func (*Tx) SetStreamOffset ¶
type VectorIndexMode ¶
type VectorIndexMode uint8
const ( VectorIndexExactOnly VectorIndexMode = iota VectorIndexHNSWSynchronous )
type VectorIndexStats ¶
type VectorIndexStats struct {
LiveEntries uint64
IndexEntries uint64
Tombstones uint64
TombstoneBytes uint64
TombstoneBytesUntilRebuild uint64
MutationDebt uint64
RebuildThreshold uint64
DebtUntilRebuild uint64
EstimatedBuildLogicalBytes uint64
ExactFallbacks uint64
Rebuilds uint64
RebuildNanoseconds uint64
}