pg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 49 Imported by: 17

Documentation

Index

Constants

View Source
const (
	// DriverName is the connection-string scheme registered by the PostgreSQL
	// driver.
	DriverName = "pg"
)
View Source
const (
	// LargeNodeUpdateThreshold is the node count above which batch updates use
	// the large-update execution path.
	LargeNodeUpdateThreshold = 1_000_000
)
View Source
const (

	// MaxCachedCypherQueryBytes excludes oversized query strings from reusable
	// parse and translation caches while still allowing them to execute.
	MaxCachedCypherQueryBytes = 64 * 1024
)
View Source
const TraversalFixedSuffixShapeVersion = "fixed-suffix-shape-v1"

TraversalFixedSuffixShapeVersion identifies the independently versioned structural identity for a variable expansion with a fixed terminal suffix. It intentionally does not reinterpret existing shortest-path v1 hashes.

View Source
const TraversalShapeVersion = "traversal-shape-v1"

TraversalShapeVersion identifies the stable structural identity used by production-wide selection. It deliberately excludes query text, identifiers, caller values, graph contents, and transaction state.

Variables

This section is empty.

Functions

func AfterPooledConnectionEstablished added in v0.5.4

func AfterPooledConnectionEstablished(ctx context.Context, conn *pgx.Conn) error

AfterPooledConnectionEstablished registers exact-number JSON decoding and loads the driver's owned graph composite types on a new pooled connection.

func AfterPooledConnectionRelease added in v0.5.4

func AfterPooledConnectionRelease(conn *pgx.Conn) bool

func EnsureStableSnapshotTraversalWorkspaces added in v1.0.0

func EnsureStableSnapshotTraversalWorkspaces(ctx context.Context, conn *pgxpool.Conn) error

EnsureStableSnapshotTraversalWorkspaces initializes the reusable session-local workspace required before stable-snapshot traversal queries. Drivers with connection-local lifecycle state may call this only when their tracked physical connection is not already ready.

func IsPostgreSQLGraph

func IsPostgreSQLGraph(db graph.Database) bool

func NewPool

func NewPool(poolCfg *pgxpool.Config) (*pgxpool.Pool, error)

NewPool constructs the default PostgreSQL pool. The returned bare pgx pool carries all DAWGS lifecycle hooks and is safe to pass through dawgs.Config.

func NewPoolWithRuntimeConfig added in v1.0.0

func NewPoolWithRuntimeConfig(ctx context.Context, poolConfig *pgxpool.Config, config RuntimeConfig) (*pgxpool.Pool, error)

NewPoolWithRuntimeConfig constructs a PostgreSQL pool with connection-local cache state. It copies poolConfig before composing required and caller lifecycle hooks, leaving the caller's configuration reusable.

func NewValueMapper

func NewValueMapper(ctx context.Context, kindMapper KindMapper) graph.ValueMapper

func OptimizedTranslationEnabled added in v0.8.0

func OptimizedTranslationEnabled() bool

OptimizedTranslationEnabled reports whether PostgreSQL Cypher translation uses optimization and the translation cache for newly started compilations.

func OptionInitializeTraversalRuntimeAttestation added in v1.0.0

func OptionInitializeTraversalRuntimeAttestation() graph.TransactionOption

OptionInitializeTraversalRuntimeAttestation prepares the acquired PostgreSQL session before an explicit read-only transaction begins. Callers that arm traversal runtime receipts inside a graph transaction need this option because PostgreSQL forbids creating the temporary workspace after BEGIN READ ONLY. GraphBench normally pins and prepares its session before the timed transaction instead.

func OptionSetQueryExecMode

func OptionSetQueryExecMode(queryExecMode pgx.QueryExecMode) graph.TransactionOption

OptionSetQueryExecMode classifies option set query exec mode for downstream policy decisions.

func OptionSetTransactionIsolation added in v1.0.0

func OptionSetTransactionIsolation(isolation pgx.TxIsoLevel) graph.TransactionOption

OptionSetTransactionIsolation requests an explicit PostgreSQL transaction at the supplied isolation level. B traversal candidates are selected only for REPEATABLE READ or SERIALIZABLE transactions. The driver prepares the production shortest-path and all-shortest-path temporary workspaces on the acquired session before beginning either stable-snapshot transaction and uses PostgreSQL READ WRITE access so those session-local tables can reset.

func OptionSkipStableSnapshotTraversalWorkspacesForTool added in v1.0.0

func OptionSkipStableSnapshotTraversalWorkspacesForTool() graph.TransactionOption

OptionSkipStableSnapshotTraversalWorkspacesForTool keeps a Repeatable Read ordinary-expansion measurement free of unrelated shortest-path workspace setup. It is intentionally tool-scoped and does not alter production policy.

func SetOptimizedTranslation added in v0.8.0

func SetOptimizedTranslation(enabled bool) bool

SetOptimizedTranslation enables or disables optimized PostgreSQL Cypher translation for the current process. It returns the previous setting.

Disabling optimization bypasses the translation cache and uses the baseline translation path for calls that begin after the setting changes. Existing cached entries remain available if optimization is enabled again.

func TranslationParameterTypeKey added in v1.0.0

func TranslationParameterTypeKey(parameters map[string]any) string

TranslationParameterTypeKey encodes sorted parameter names and negotiated PostgreSQL data types into an unambiguous cache-key component.

func TraversalPolicyQuerySHA256 added in v1.0.0

func TraversalPolicyQuerySHA256(query string) string

TraversalPolicyQuerySHA256 returns the stable digest used by policy allowlists. Only surrounding whitespace is normalized. Collapsing interior whitespace is unsafe because whitespace inside string literals and escaped identifiers is semantically significant.

func TraversalSQLTemplateSHA256 added in v1.0.0

func TraversalSQLTemplateSHA256(candidate, selectorVersion, executionBoundary string, shape TraversalShape) string

TraversalSQLTemplateSHA256 returns the public template-contract digest for a v3 or v4 structural bucket. It binds the candidate and every SQL-shaping static fact, but intentionally excludes Cypher identifiers and caller values.

func TraversalShapeFingerprint added in v1.0.0

func TraversalShapeFingerprint(shape TraversalShape) string

TraversalShapeFingerprint returns the immutable digest that a structural promotion bucket must bind. It never includes query text or runtime values.

Types

type CompilationCacheStats added in v1.0.0

type CompilationCacheStats struct {
	Hits                    int64
	Misses                  int64
	Coalesced               int64
	Bypasses                int64
	Insertions              int64
	Evictions               int64
	BindingFailures         int64
	BuildFailures           int64
	UnoptimizedCompilations int64
	Size                    int64
	Capacity                int
	Generation              uint64
}

CompilationCacheStats contains aggregate counters only. It intentionally exposes no source text, SQL, parameter names, values, or connection data.

type Config

type Config struct {
	// Options controls PostgreSQL transaction isolation and access mode.
	Options pgx.TxOptions

	// QueryExecMode selects pgx's query execution protocol.
	QueryExecMode pgx.QueryExecMode

	// QueryResultFormats selects the PostgreSQL wire format for returned columns.
	QueryResultFormats pgx.QueryResultFormats

	// BatchWriteSize is the number of mutations accumulated before a batch flushes.
	BatchWriteSize int
	// contains filtered or unexported fields
}

Config configures PostgreSQL transaction execution for one graph operation.

type ConnectionCacheStats added in v1.0.0

type ConnectionCacheStats struct {
	// ID is an opaque provider-assigned identifier for the live connection.
	ID uint64 `json:"id"`

	// Translation reports cache activity scoped to this physical connection.
	Translation TranslationCacheStats `json:"translation"`

	// TraversalWorkspace reports setup state scoped to this physical connection.
	TraversalWorkspace TraversalWorkspaceStats `json:"traversal_workspace"`

	// PreparedStatements reports selected statement warm-up for this connection.
	PreparedStatements PreparedStatementStats `json:"prepared_statements"`
}

ConnectionCacheStats describes one currently live connection cache. ID is an opaque diagnostic identifier; it is not a backend PID or pointer value.

type CypherTranslationCache added in v1.0.0

type CypherTranslationCache interface {
	TranslateWithPolicy(
		query string,
		graphID int32,
		parameters map[string]any,
		policyIdentity string,
		build func() (translate.Result, string, error),
	) (string, map[string]any, error)
}

CypherTranslationCache implements reusable Cypher-to-SQL translation. Implementations must not retain caller parameter values or mutable maps.

type CypherTranslationCacheProvider added in v1.0.0

type CypherTranslationCacheProvider interface {
	CacheForConnection(conn *pgx.Conn) CypherTranslationCache
}

CypherTranslationCacheProvider selects cache ownership for a physical connection. Returning nil deliberately bypasses translation retention.

type Driver

type Driver struct {
	*SchemaManager
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(graphQueryMemoryLimit size.Size, pool *pgxpool.Pool) *Driver

func NewDriverWithOptions added in v0.8.0

func NewDriverWithOptions(graphQueryMemoryLimit size.Size, pool *pgxpool.Pool, options DriverOptions) *Driver

NewDriverWithOptions constructs a PostgreSQL driver with driver-wide options.

func (*Driver) AssertSchema

func (s *Driver) AssertSchema(ctx context.Context, schema graph.Schema) error

AssertSchema creates or validates the requested schema and resets pooled type metadata afterward.

func (*Driver) BatchOperation

func (s *Driver) BatchOperation(ctx context.Context, batchDelegate graph.BatchDelegate, options ...graph.BatchOption) error

BatchOperation runs batchDelegate in a write batch using the supplied batch options.

func (*Driver) Close

func (s *Driver) Close(ctx context.Context) error

Close stops the driver's query caches before releasing its PostgreSQL pool.

func (*Driver) CompilationCacheStats added in v1.0.0

func (s *Driver) CompilationCacheStats() CompilationCacheStats

CompilationCacheStats returns aggregate PostgreSQL compiler-cache counters.

func (*Driver) DeleteNodesByKinds added in v0.7.0

func (s *Driver) DeleteNodesByKinds(ctx context.Context, includeAny graph.Kinds, excludeAny graph.Kinds) error

DeleteNodesByKinds performs a server-side, set-based delete of nodes using the kind_ids GIN index instead of streaming node IDs through the application. A node is deleted when its kind_ids overlap includeAny (or, when includeAny is empty, for every node) and do not overlap excludeAny. Deleting nodes fires the delete_node_edges trigger, cascading the attached edge deletes.

includeAny is mapped to kind IDs tolerantly: include kinds that are not defined in the database map to no IDs and therefore match no nodes, so a request that targets only undefined kinds is a safe no-op rather than an accidental full delete. excludeAny is mapped fail-closed: if any exclude kind is undefined the delete is refused, because silently dropping an exclusion would widen the delete and could remove protected nodes (e.g. an unresolved MigrationData would turn a guarded wipe into an unguarded delete from node).

func (*Driver) DeleteRelationshipsByKinds added in v0.7.0

func (s *Driver) DeleteRelationshipsByKinds(ctx context.Context, kinds graph.Kinds) error

DeleteRelationshipsByKinds performs a server-side, set-based delete of relationships whose kind_id matches any of the given kinds, using the edge_kind_index for kind filtering instead of streaming relationship IDs through the application.

kinds are mapped to kind IDs tolerantly: kinds that are not defined in the database map to no IDs. An empty kinds argument, or one that maps entirely to undefined kinds, deletes nothing rather than every relationship.

func (*Driver) FetchKinds

func (s *Driver) FetchKinds(_ context.Context) (graph.Kinds, error)

FetchKinds returns the current in-memory graph-kind mapping.

func (*Driver) FetchSchema

func (s *Driver) FetchSchema(ctx context.Context) (graph.Schema, error)

FetchSchema is not implemented because PostgreSQL schema discovery is owned by SchemaManager.

func (*Driver) KindMapper

func (s *Driver) KindMapper() KindMapper

KindMapper returns the driver's graph-kind to PostgreSQL-ID mapper.

func (*Driver) OptimizeStorage added in v0.6.0

func (s *Driver) OptimizeStorage(ctx context.Context) error

OptimizeStorage runs PostgreSQL storage maintenance on a leased pool connection.

func (*Driver) ParseCacheStats added in v1.0.0

func (s *Driver) ParseCacheStats() ParseCacheStats

ParseCacheStats returns query-text-free counters for this driver's bounded Cypher parse cache.

func (*Driver) RefreshKinds

func (s *Driver) RefreshKinds(ctx context.Context) error

RefreshKinds discards and reloads the driver's in-memory kind mapping.

func (*Driver) RefreshTraversalTopologySynopsis added in v1.0.0

func (s *Driver) RefreshTraversalTopologySynopsis(ctx context.Context, target graph.Graph) (TraversalTopologySynopsis, error)

RefreshTraversalTopologySynopsis publishes a versioned graph topology synopsis. The graph epoch row is locked before collection, so the synopsis is current at its commit boundary; a mutation committed afterwards can immediately make it stale.

func (*Driver) Run

func (s *Driver) Run(ctx context.Context, query string, parameters map[string]any) error

Run executes raw SQL in a write transaction and returns its terminal result error.

func (*Driver) SetBatchWriteSize

func (s *Driver) SetBatchWriteSize(size int)

SetBatchWriteSize changes the process-wide mutation count used for new batch flushes.

func (*Driver) SetDefaultGraph

func (s *Driver) SetDefaultGraph(ctx context.Context, graphSchema graph.Graph) error

SetDefaultGraph validates and selects graphSchema as the driver's default graph.

func (*Driver) SetStatementWarmupPolicy added in v1.0.0

func (s *Driver) SetStatementWarmupPolicy(ctx context.Context, statements ...string) error

SetStatementWarmupPolicy installs the warm set for current and future physical connections.

func (*Driver) SetTraversalPolicy added in v1.0.0

func (s *Driver) SetTraversalPolicy(policy TraversalPolicy) error

SetTraversalPolicy atomically replaces production canary selection. The zero value disables all candidates; old cached SQL becomes unreachable because the effective policy identity changes immediately.

func (*Driver) SetWriteFlushSize

func (s *Driver) SetWriteFlushSize(size int)

SetWriteFlushSize is a no-op because PostgreSQL batches do not rotate transactions by size.

func (*Driver) TranslationCacheStats added in v0.8.0

func (s *Driver) TranslationCacheStats() Stats

TranslationCacheStats returns query-text-free counters for this driver's bounded Cypher-to-SQL translation cache.

func (*Driver) TraversalPolicy added in v1.0.0

func (s *Driver) TraversalPolicy() TraversalPolicy

TraversalPolicy returns an immutable snapshot of the active policy.

func (*Driver) WarmStatements added in v1.0.0

func (s *Driver) WarmStatements(ctx context.Context, statements ...string) error

WarmStatements prepares selected SQL on currently idle physical connections without executing it.

func (*Driver) WipeGraph added in v0.7.0

func (s *Driver) WipeGraph(ctx context.Context, retain graph.TransactionDelegate) error

WipeGraph truncates the partitioned node and edge tables, removing every node and edge across all graphs in a single statement that bypasses the per-row edge cascade trigger. The optional retain delegate runs within the same transaction after the truncate, allowing callers to atomically recreate any data that must survive the wipe. If retain returns an error the transaction is rolled back and the graph is left untouched.

type DriverOptions added in v0.8.0

type DriverOptions struct {
	TranslationCacheEntries int
}

DriverOptions configures driver-wide behavior. TranslationCacheEntries is a count, not a per-connection setting; zero disables translation caching.

func DefaultDriverOptions added in v0.8.0

func DefaultDriverOptions() DriverOptions

DefaultDriverOptions returns the driver-wide PostgreSQL settings used by NewDriver.

type Int2ArrayEncoder

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

func (*Int2ArrayEncoder) Encode

func (s *Int2ArrayEncoder) Encode(values []int16) string

type IterationOptions

type IterationOptions interface {
	Once()
}

type KindMapper

type KindMapper interface {
	// MapKindID resolves one PostgreSQL kind identifier to its graph kind.
	MapKindID(ctx context.Context, kindID int16) (graph.Kind, error)

	// MapKindIDs resolves PostgreSQL kind identifiers to their graph kinds.
	MapKindIDs(ctx context.Context, kindIDs []int16) (graph.Kinds, error)

	// MapKind resolves one graph kind to its PostgreSQL identifier.
	MapKind(ctx context.Context, kind graph.Kind) (int16, error)

	// MapKinds resolves graph kinds to their PostgreSQL identifiers.
	MapKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)

	// AssertKinds creates missing kinds and returns PostgreSQL identifiers for every input kind.
	AssertKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
}

KindMapper translates graph kind names to and from PostgreSQL kind identifiers.

func KindMapperFromGraphDatabase

func KindMapperFromGraphDatabase(graphDB graph.Database) (KindMapper, error)

KindMapperFromGraphDatabase returns graphDB's PostgreSQL kind mapper when it exposes one.

type LargeNodeUpdateRows added in v0.4.12

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

LargeNodeUpdateRows accumulates encoded node rows for bulk loading via COPY FROM. The column order matches sql.NodeUpdateStagingColumns.

func NewLargeNodeUpdateRows added in v0.4.12

func NewLargeNodeUpdateRows(size int) *LargeNodeUpdateRows

func (*LargeNodeUpdateRows) Append added in v0.4.12

func (s *LargeNodeUpdateRows) Append(ctx context.Context, node *graph.Node, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error

Append retains the public schema-manager entry point.

func (*LargeNodeUpdateRows) AppendAll added in v0.4.12

func (s *LargeNodeUpdateRows) AppendAll(ctx context.Context, nodes []*graph.Node, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error

AppendAll retains the public schema-manager entry point.

func (*LargeNodeUpdateRows) Rows added in v0.4.12

func (s *LargeNodeUpdateRows) Rows() [][]any

type LazyStableSnapshotTraversalWorkspaceProvider added in v1.0.0

type LazyStableSnapshotTraversalWorkspaceProvider interface {
	// DeferStableSnapshotTraversalWorkspaces reports whether workspaces may initialize on first use.
	DeferStableSnapshotTraversalWorkspaces() bool
}

LazyStableSnapshotTraversalWorkspaceProvider elects to initialize traversal workspaces only when a shortest-path query is actually issued. This is safe for V2 because readiness remains tied to the leased physical connection and schema generation.

type NodeUpdateParameters added in v0.4.12

type NodeUpdateParameters struct {
	NodeIDs           []graph.ID
	KindSlices        []string
	DeletedKindSlices []string
	Properties        []pgtype.JSONB
	DeletedProperties []string
}

func NewNodeUpdateParameters added in v0.4.12

func NewNodeUpdateParameters(size int) *NodeUpdateParameters

func (*NodeUpdateParameters) Append added in v0.4.12

func (s *NodeUpdateParameters) Append(ctx context.Context, node *graph.Node, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error

Append retains the public schema-manager entry point.

func (*NodeUpdateParameters) AppendAll added in v0.4.12

func (s *NodeUpdateParameters) AppendAll(ctx context.Context, nodes []*graph.Node, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error

AppendAll retains the public schema-manager entry point.

func (*NodeUpdateParameters) Format added in v0.4.12

func (s *NodeUpdateParameters) Format() []any

type NodeUpsertParameters

type NodeUpsertParameters struct {
	IDFutures    []*sql.Future[graph.ID]
	KindIDSlices []string
	Properties   []pgtype.JSONB
}

func NewNodeUpsertParameters

func NewNodeUpsertParameters(size int) *NodeUpsertParameters

func (*NodeUpsertParameters) Append

func (s *NodeUpsertParameters) Append(ctx context.Context, update *sql.NodeUpdate, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error

Append retains the public schema-manager entry point.

func (*NodeUpsertParameters) AppendAll

func (s *NodeUpsertParameters) AppendAll(ctx context.Context, updates *sql.NodeUpdateBatch, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error

AppendAll retains the public schema-manager entry point.

func (*NodeUpsertParameters) Format

func (s *NodeUpsertParameters) Format(graphTarget model.Graph) []any

type ParseCacheStats added in v1.0.0

type ParseCacheStats struct {
	// Hits counts lookups served from completed cache entries.
	Hits uint64 `json:"hits"`

	// Misses counts queries parsed by the caller that established a pending entry.
	Misses uint64 `json:"misses"`

	// Bypasses counts queries parsed without retention because caching was unavailable or disallowed.
	Bypasses uint64 `json:"bypasses"`

	// Evictions counts least-recently-used translations removed at capacity.
	Evictions uint64 `json:"evictions"`

	// CoalescedMisses counts callers that waited for an existing parse of the same query.
	CoalescedMisses uint64 `json:"coalesced_misses"`

	// Entries is the number of completed parses retained when the snapshot was taken.
	Entries int `json:"entries"`

	// Pending is the number of in-flight parses when the snapshot was taken.
	Pending int `json:"pending"`

	// Shards is the number of independently locked cache partitions.
	Shards int `json:"shards"`
}

ParseCacheStats contains aggregate, query-text-free diagnostics. It is a snapshot; counters are scoped to one driver instance and reset only when the driver is reconstructed.

type PoolConfig added in v1.0.0

type PoolConfig struct {
	// MinConnections keeps this many idle physical connections available when possible.
	MinConnections int32

	// MaxConnections caps the number of physical PostgreSQL connections.
	MaxConnections int32
}

PoolConfig controls the pgx pool size owned by a PostgreSQL driver. It is optional in RuntimeConfig so existing callers retain the 5-50 connection defaults. Supplying PoolConfig permits a minimum of zero connections.

type PreparedStatementStats added in v1.0.0

type PreparedStatementStats struct {
	// Attempts counts requests to prepare selected statements.
	Attempts uint64 `json:"attempts"`

	// Prepared counts statements successfully prepared on a connection.
	Prepared uint64 `json:"prepared"`

	// Reuses counts requests satisfied by an already prepared statement.
	Reuses uint64 `json:"reuses"`

	// Failures counts prepare requests rejected by PostgreSQL.
	Failures uint64 `json:"failures"`

	// Entries is the number of statement identities retained for the connection.
	Entries int `json:"entries"`
}

PreparedStatementStats describes opt-in statement warm-up activity. Entries counts only SHA-256 statement identities, never SQL text or parameter data.

type QueryHook

type QueryHook interface {
	OnStatementMatch(statement string) QueryHookOptions
	OnStatementRegex(re *regexp.Regexp) QueryHookOptions
}

type QueryHookOptions

type QueryHookOptions interface {
	Trace() IterationOptions
}

type QueryPathInspector

type QueryPathInspector interface {
	Hook() QueryHook
}

func Inspector

func Inspector() QueryPathInspector

type RelationshipUpdateByParameters

type RelationshipUpdateByParameters struct {
	StartIDs   []graph.ID
	EndIDs     []graph.ID
	KindIDs    []int16
	Properties []pgtype.JSONB
}

func NewRelationshipUpdateByParameters

func NewRelationshipUpdateByParameters(size int) *RelationshipUpdateByParameters

func (*RelationshipUpdateByParameters) Append

Append retains the public schema-manager entry point.

func (*RelationshipUpdateByParameters) AppendAll

func (s *RelationshipUpdateByParameters) AppendAll(ctx context.Context, updates *sql.RelationshipUpdateBatch, schemaManager *SchemaManager) error

AppendAll retains the public schema-manager entry point.

func (*RelationshipUpdateByParameters) Format

func (s *RelationshipUpdateByParameters) Format(graphTarget model.Graph) []any

type RuntimeConfig added in v1.0.0

type RuntimeConfig struct {
	// TranslationCacheEntries is the exact SIEVE entry capacity for each live
	// physical PostgreSQL connection. Zero disables retention.
	TranslationCacheEntries int

	// SharedShortestPathTemplateEntries bounds immutable shortest-path SQL
	// templates shared by V2 physical connections. Zero disables this L2 tier.
	SharedShortestPathTemplateEntries int

	// Pool optionally overrides the v1-compatible connection limits. Nil uses
	// DefaultConfig's limits; a non-nil value must have MaxConnections >= 1
	// and MinConnections <= MaxConnections.
	Pool *PoolConfig
}

RuntimeConfig configures the connection-resident translation cache.

func DefaultRuntimeConfig added in v1.0.0

func DefaultRuntimeConfig() RuntimeConfig

DefaultRuntimeConfig returns the conservative PostgreSQL defaults. The aggregate upper bound is TranslationCacheEntries multiplied by the number of live physical PostgreSQL connections.

type SQLGenerationProfile added in v1.0.0

type SQLGenerationProfile struct {
	// QueryClass is a low-cardinality category that omits query text and values.
	QueryClass string

	// Parse measures Cypher parsing and parse-cache lookup time.
	Parse time.Duration

	// Graph measures graph-target resolution time.
	Graph time.Duration

	// Policy measures traversal-shape classification and policy selection time.
	Policy time.Duration

	// Cache measures translation-cache lookup and binding time.
	Cache time.Duration

	// Translate measures Cypher-to-SQL translation time on cache misses.
	Translate time.Duration

	// Format measures SQL rendering time after translation.
	Format time.Duration

	// Dispatch measures client-side PostgreSQL query dispatch time.
	Dispatch time.Duration
}

SQLGenerationProfile is a query-text-free timing sample for the PostgreSQL Cypher-to-SQL execution boundary. Graph-query durations end once pgx has accepted the query and returned its row stream; server planning and execution are captured separately through PostgreSQL EXPLAIN diagnostics.

The profile intentionally contains neither Cypher nor SQL text, parameter values, backend identifiers, nor result data. Metadata operations use the kind_lookup, kind_refresh and kind_register classes; their Dispatch measures the complete metadata operation, including consuming and closing its rows.

type SQLGenerationProfileCollector added in v1.0.0

type SQLGenerationProfileCollector interface {
	// RecordSQLGenerationProfile receives a completed query-text-free timing sample.
	RecordSQLGenerationProfile(profile SQLGenerationProfile)
}

SQLGenerationProfileCollector receives completed query-text-free timing samples. Implementations must be safe for concurrent transactions.

type SQLGenerationStats added in v1.0.0

type SQLGenerationStats struct {
	// KindLookup counts targeted catalog reads; Dispatch includes their full duration.
	KindLookup SQLGenerationTiming `json:"kind_lookup"`
	// KindRefresh counts full catalog reloads; Dispatch includes their full duration.
	KindRefresh SQLGenerationTiming `json:"kind_refresh"`
	// KindRegistration counts registration operations, including concurrent-insert retries.
	KindRegistration SQLGenerationTiming `json:"kind_registration"`

	// ShortestPath aggregates generation timings for shortest-path queries.
	ShortestPath SQLGenerationTiming `json:"shortest_path"`

	// Other aggregates generation timings for all other queries.
	Other SQLGenerationTiming `json:"other"`
}

SQLGenerationStats separates metadata operations and graph-query generation timings.

type SQLGenerationTiming added in v1.0.0

type SQLGenerationTiming struct {
	// Count records SQL generation profiles represented by this aggregate.
	Count uint64 `json:"count"`

	// Parse accumulates Cypher parsing time.
	Parse time.Duration `json:"parse"`

	// Graph accumulates graph-resolution time.
	Graph time.Duration `json:"graph"`

	// Policy accumulates traversal-policy selection time.
	Policy time.Duration `json:"policy"`

	// Cache accumulates translation-cache lookup time.
	Cache time.Duration `json:"cache"`

	// Translate accumulates Cypher-to-SQL lowering time.
	Translate time.Duration `json:"translate"`

	// Format accumulates SQL rendering time.
	Format time.Duration `json:"format"`

	// Dispatch accumulates pgx query-dispatch time.
	Dispatch time.Duration `json:"dispatch"`
}

SQLGenerationTiming contains aggregate V2 SQL-generation durations. Count is separate so a zero-cost stage remains observable.

type SQLState

type SQLState string
const (
	StateObjectDoesNotExist SQLState = "42704"
)

func (SQLState) ErrorMatches

func (s SQLState) ErrorMatches(err error) bool

func (SQLState) String

func (s SQLState) String() string

type SchemaManager

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

SchemaManager coordinates graph and kind metadata with the query caches that depend on that schema state.

func NewSchemaManager

func NewSchemaManager(pool *pgxpool.Pool, graphQueryMemoryLimit size.Size, providers ...CypherTranslationCacheProvider) *SchemaManager

NewSchemaManager creates an empty metadata manager with bounded parse and compilation caches and an optional connection-local translation provider.

func NewSchemaManagerWithOptions added in v0.8.0

func NewSchemaManagerWithOptions(pool *pgxpool.Pool, graphQueryMemoryLimit size.Size, options DriverOptions) *SchemaManager

NewSchemaManagerWithOptions constructs the shared compilation service with a bounded translation cache.

func NewSchemaManagerWithTranslationCache added in v0.8.0

func NewSchemaManagerWithTranslationCache(pool *pgxpool.Pool, graphQueryMemoryLimit size.Size, translationCacheEntries int) *SchemaManager

NewSchemaManagerWithTranslationCache permits an application to disable the compilation cache (zero), or to choose a bounded driver-wide entry capacity. Negative values disable the cache.

func (*SchemaManager) AssertDefaultGraph

func (s *SchemaManager) AssertDefaultGraph(ctx context.Context, schema graph.Graph) error

AssertDefaultGraph creates or validates schema and records it as the immutable default target.

func (*SchemaManager) AssertGraph

func (s *SchemaManager) AssertGraph(tx graph.Transaction, schema graph.Graph) (model.Graph, error)

AssertGraph explicitly reconciles schema, even when the graph was previously cached.

func (*SchemaManager) AssertKinds

func (s *SchemaManager) AssertKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)

AssertKinds registers kinds on one leased connection and publishes only committed metadata.

func (*SchemaManager) AssertSchema

func (s *SchemaManager) AssertSchema(ctx context.Context, schema graph.Schema) error

AssertSchema creates base storage and defines kinds required by every graph in schema.

func (*SchemaManager) DefaultGraph

func (s *SchemaManager) DefaultGraph() (model.Graph, bool)

DefaultGraph returns the cached default graph and whether one has been selected.

func (*SchemaManager) Fetch

func (s *SchemaManager) Fetch(ctx context.Context) error

Fetch explicitly reloads committed metadata on a safe autocommit connection. Bootstrap bypasses automatic servicing, so pending requests cause only one fetch.

func (*SchemaManager) GetKindIDsByKind

func (s *SchemaManager) GetKindIDsByKind() map[int16]graph.Kind

GetKindIDsByKind returns an owned, independently mutable snapshot.

func (*SchemaManager) MapKind

func (s *SchemaManager) MapKind(ctx context.Context, kind graph.Kind) (int16, error)

MapKind resolves a name, looking up only missing names on one owned connection.

func (*SchemaManager) MapKindID

func (s *SchemaManager) MapKindID(ctx context.Context, id int16) (graph.Kind, error)

MapKindID resolves an ID without database I/O, including during result decoding.

func (*SchemaManager) MapKindIDs

func (s *SchemaManager) MapKindIDs(ctx context.Context, ids []int16) (graph.Kinds, error)

func (*SchemaManager) MapKinds

func (s *SchemaManager) MapKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)

func (*SchemaManager) ReadTransaction

func (s *SchemaManager) ReadTransaction(ctx context.Context, txDelegate graph.TransactionDelegate, options ...graph.TransactionOption) error

ReadTransaction executes txDelegate on a leased read-only connection or transaction.

func (*SchemaManager) SelectGraph added in v1.0.0

func (s *SchemaManager) SelectGraph(tx graph.Transaction, name string) (model.Graph, error)

SelectGraph resolves an existing graph without creating or reconciling schema.

func (*SchemaManager) SetDefaultGraph

func (s *SchemaManager) SetDefaultGraph(ctx context.Context, schema graph.Graph) error

SetDefaultGraph validates an existing graph and records it as the immutable default target.

func (*SchemaManager) WriteTransaction

func (s *SchemaManager) WriteTransaction(ctx context.Context, txDelegate graph.TransactionDelegate, options ...graph.TransactionOption) error

WriteTransaction executes txDelegate in an explicit read-write PostgreSQL transaction.

type SharedTemplateStats added in v1.0.0

type SharedTemplateStats struct {
	// Hits counts templates served from the shared shortest-path tier.
	Hits uint64 `json:"hits"`

	// Misses counts shared-tier lookups without a retained template.
	Misses uint64 `json:"misses"`

	// Insertions counts templates added to the shared tier.
	Insertions uint64 `json:"insertions"`

	// Evictions counts templates displaced from the shared tier at capacity.
	Evictions uint64 `json:"evictions"`

	// Entries is the shared-tier occupancy at snapshot time.
	Entries int `json:"entries"`

	// Capacity bounds retained templates in the shared tier.
	Capacity int `json:"capacity"`
}

SharedTemplateStats reports the bounded V2-wide immutable shortest-path template tier. It excludes query text and caller values.

type StableSnapshotTraversalWorkspaceProvider added in v1.0.0

type StableSnapshotTraversalWorkspaceProvider interface {
	// EnsureStableSnapshotTraversalWorkspaces initializes workspaces for conn when required.
	EnsureStableSnapshotTraversalWorkspaces(ctx context.Context, conn *pgxpool.Conn) error
}

StableSnapshotTraversalWorkspaceProvider optionally owns the readiness of session-local traversal workspaces. Providers must treat a closed or replaced physical connection as unready.

type Stats added in v1.0.0

type Stats struct {
	// SchemaGeneration partitions state invalidated by schema-sensitive changes.
	SchemaGeneration uint64 `json:"schema_generation"`

	// CapacityPerConnection bounds retained translations for one live connection.
	CapacityPerConnection int `json:"capacity_per_connection"`

	// MinConnections is the configured pgx pool lower connection bound.
	MinConnections int32 `json:"min_connections"`

	// MaxConnections is the configured pgx pool upper connection bound.
	MaxConnections int32 `json:"max_connections"`

	// LiveConnections counts physical connections currently registered by the provider.
	LiveConnections int `json:"live_connections"`

	// RetiredConnections counts connections whose cache state has been closed.
	RetiredConnections uint64 `json:"retired_connections"`

	// Aggregate combines active and retired translation-cache statistics.
	Aggregate TranslationCacheStats `json:"aggregate"`

	// TraversalWorkspace aggregates reusable workspace setup activity.
	TraversalWorkspace TraversalWorkspaceStats `json:"traversal_workspace"`

	// PreparedStatements aggregates selected statement warm-up activity.
	PreparedStatements PreparedStatementStats `json:"prepared_statements"`

	// Connections reports cache state for each currently live physical connection.
	Connections []ConnectionCacheStats `json:"connections"`

	// SQLGeneration aggregates query-text-free SQL generation timings.
	SQLGeneration SQLGenerationStats `json:"sql_generation"`

	// StrategySelection aggregates production routing observations.
	StrategySelection StrategySelectionStats `json:"strategy_selection"`

	// TraversalShapeCache reports bounded structural classifier cache activity.
	TraversalShapeCache TraversalShapeCacheStats `json:"traversal_shape_cache"`

	// TraversalRouteDecision aggregates topology route-decision outcomes.
	TraversalRouteDecision TraversalRouteDecisionStats `json:"traversal_route_decision"`

	// SharedShortestPathTemplates reports the pool-wide immutable template cache.
	SharedShortestPathTemplates SharedTemplateStats `json:"shared_shortest_path_templates"`
}

Stats is a query-text-free provider snapshot. Aggregate combines live and retired connection counters; its Capacity is the current theoretical bound across live connections, not a global retained-entry limit.

type StrategySelectionStats added in v1.0.0

type StrategySelectionStats struct {
	// Incumbent counts selections that leave the stable executor active.
	Incumbent uint64 `json:"incumbent"`

	// ExactQueryCanary counts candidates selected by exact-query authorization.
	ExactQueryCanary uint64 `json:"exact_query_canary"`

	// StructuralShadow counts structural matches observed without authorization.
	StructuralShadow uint64 `json:"structural_shadow"`

	// StructuralAuthorized counts candidates selected by structural authorization.
	StructuralAuthorized uint64 `json:"structural_authorized"`

	// TopologySelected counts candidates selected by transaction-local topology routing.
	TopologySelected uint64 `json:"topology_selected"`

	// ShapeUnavailable counts queries outside the structural classifier scope.
	ShapeUnavailable uint64 `json:"shape_unavailable"`
}

StrategySelectionStats records query-text-free production-routing observations. These counters describe selection only; they do not claim an emitted candidate executed.

type SuffixReverseRetryLimits added in v1.0.0

type SuffixReverseRetryLimits struct {
	// OutputRows caps the number of candidate rows buffered before publication.
	OutputRows int64

	// OutputBytes caps the JSON-encoded size of buffered candidate values.
	OutputBytes int64
}

SuffixReverseRetryLimits freezes the development candidate's public buffer boundary independently of SQL translation. Values must match the lowering metadata used to render the candidate statement.

type SuffixReverseRetryTransaction added in v1.0.0

type SuffixReverseRetryTransaction interface {
	// RawSuffixReverseRetry runs a bounded candidate and, if needed, its exact fallback.
	RawSuffixReverseRetry(candidateSQL, fallbackSQL string, candidateParameters, fallbackParameters map[string]any, limits SuffixReverseRetryLimits) graph.Result
}

SuffixReverseRetryTransaction is a tool-only PostgreSQL execution surface. It is intentionally absent from graph.Transaction and cannot affect ordinary production queries without an explicit type assertion by repository tooling.

type TranslationCacheStats added in v0.8.0

type TranslationCacheStats struct {
	// Hits counts translations served from the connection-local cache.
	Hits uint64 `json:"hits"`

	// Misses counts translations not found in the connection-local cache.
	Misses uint64 `json:"misses"`

	// Bypasses counts translations intentionally built without retention.
	Bypasses uint64 `json:"bypasses"`

	// Insertions counts reusable translations published to the local cache.
	Insertions uint64 `json:"insertions"`

	// Evictions counts cached translations displaced at capacity.
	Evictions uint64 `json:"evictions"`

	// BindingFailures counts cache hits that cannot bind current caller values.
	BindingFailures uint64 `json:"binding_failures"`

	// Entries is the local cache occupancy at snapshot time.
	Entries int `json:"entries"`

	// Capacity is the maximum number of retained local translations.
	Capacity int `json:"capacity"`
}

TranslationCacheStats is a query-text-free snapshot of one connection's translation cache activity and occupancy.

type TraversalPolicy added in v1.0.0

type TraversalPolicy struct {
	// Generation distinguishes policy revisions in cache and rollout identities.
	Generation uint64 `json:"generation"`

	// PromotionManifestSHA256 verifies the immutable promotion manifest supplied below.
	PromotionManifestSHA256 string `json:"promotion_manifest_sha256"`

	// PromotionManifestJSON is the exact verified authorization document. It
	// is intentionally excluded from policy serialization; its digest and
	// content-derived fields form the cache identity.
	PromotionManifestJSON json.RawMessage `json:"-"`
	// QuerySHA256Allowlist is the exact set of query digests authorized by the manifest.
	QuerySHA256Allowlist []string `json:"query_sha256_allowlist"`

	// ShortestPathExecutor selects the manifest-backed shortest-path candidate.
	ShortestPathExecutor optimize.ShortestPathExecutor `json:"shortest_path_executor,omitempty"`

	// EnableExpansionOrientation enables the manifest-backed expansion orientation candidate.
	EnableExpansionOrientation bool `json:"enable_expansion_orientation,omitempty"`
	// EnableTopologyFixedSuffix permits the manifest-v4, snapshot-owned
	// fixed-suffix candidate. It never changes ordinary routing: the
	// transaction route-decision cache must independently select the arm.
	EnableTopologyFixedSuffix bool `json:"enable_topology_fixed_suffix,omitempty"`
	// EnableTopologyFixedSuffixFirstUse permits the manifest-v5 first-use
	// selector. It is deliberately independent of the v4 cache-hit protocol.
	EnableTopologyFixedSuffixFirstUse bool `json:"enable_topology_fixed_suffix_first_use,omitempty"`
	// DisableExpansionOrientation is an evidence-free emergency rollback switch
	// for any manifest-authorized orientation selector.
	DisableExpansionOrientation bool `json:"disable_expansion_orientation,omitempty"`
	// DisableTopologyFixedSuffix is the evidence-free emergency rollback
	// switch for the manifest-v4 fixed-suffix candidate.
	DisableTopologyFixedSuffix bool `json:"disable_topology_fixed_suffix,omitempty"`
	// DisableTopologyFixedSuffixFirstUse is the emergency rollback for v5.
	DisableTopologyFixedSuffixFirstUse bool `json:"disable_topology_fixed_suffix_first_use,omitempty"`
	// DisableEndpointSeededReverse immediately disables the endpoint-seeded reverse candidate.
	DisableEndpointSeededReverse bool `json:"disable_endpoint_seeded_reverse,omitempty"`

	// DisableInlineASPDAG immediately disables the inline ASP DAG candidate.
	DisableInlineASPDAG bool `json:"disable_inline_asp_dag,omitempty"`

	// DisableInlineSPWitness immediately disables the inline shortest-path witness candidate.
	DisableInlineSPWitness bool `json:"disable_inline_sp_witness,omitempty"`
	// DisableInlineSPDistance is the emergency rollback switch for SP-I2-C-D.
	DisableInlineSPDistance bool `json:"disable_inline_sp_distance,omitempty"`
	// contains filtered or unexported fields
}

TraversalPolicy is a default-off, query-allowlisted production canary. A generation is mandatory whenever a candidate is enabled and is included in the translation cache identity.

type TraversalRouteDecision added in v1.0.0

type TraversalRouteDecision struct {
	// Mode identifies the selected candidate or incumbent arm.
	Mode string `json:"mode"`

	// Reason records the query-text-free rationale for the route decision.
	Reason string `json:"reason"`
}

TraversalRouteDecision is query-text-free shadow telemetry for a transaction-owned topology decision. Shadow decisions never alter emitted SQL and never retain caller values.

type TraversalRouteDecisionCollector added in v1.0.0

type TraversalRouteDecisionCollector interface {
	// RecordTraversalRouteDecision receives query-text-free topology routing telemetry.
	RecordTraversalRouteDecision(TraversalRouteDecision)
}

TraversalRouteDecisionCollector optionally records aggregate decision states. Implementations must not retain the per-transaction cache key.

type TraversalRouteDecisionStats added in v1.0.0

type TraversalRouteDecisionStats struct {
	// Disabled counts queries ineligible for topology routing.
	Disabled uint64 `json:"disabled"`

	// SynopsisUnavailable counts queries without a current graph synopsis.
	SynopsisUnavailable uint64 `json:"synopsis_unavailable"`

	// ShadowMiss counts first observations that populate route-decision shadow state.
	ShadowMiss uint64 `json:"shadow_miss"`

	// ShadowHit counts repeated shadow observations that remain on the incumbent.
	ShadowHit uint64 `json:"shadow_hit"`

	// CandidateHit counts repeated observations that select the candidate route.
	CandidateHit uint64 `json:"candidate_hit"`

	// FirstUseCandidate counts first-use protocol selections of the candidate route.
	FirstUseCandidate uint64 `json:"first_use_candidate"`

	// EstimateRejected counts candidates rejected by the synopsis estimate.
	EstimateRejected uint64 `json:"estimate_rejected"`

	// Capacity counts decisions rejected by bounded transaction-local state.
	Capacity uint64 `json:"capacity"`

	// ParametersInvalid counts queries whose parameters cannot be fingerprinted.
	ParametersInvalid uint64 `json:"parameters_invalid"`
}

TraversalRouteDecisionStats aggregates topology-routing shadow states without retaining transaction tokens, graph IDs, or caller values.

type TraversalShape added in v1.0.0

type TraversalShape struct {
	// Version identifies the structural-classification schema used for this shape.
	Version string `json:"version"`

	// Family identifies the eligible traversal family.
	Family string `json:"family"`

	// Direction records the traversal's logical direction.
	Direction string `json:"direction"`

	// ObservationMode identifies the semantic observation mode used by the plan.
	ObservationMode string `json:"observation_mode"`

	// MinimumDepth is the inclusive lower bound of the variable expansion.
	MinimumDepth int64 `json:"minimum_depth"`

	// MaximumDepth is the inclusive upper bound of the variable expansion.
	MaximumDepth int64 `json:"maximum_depth"`

	// RelationshipKindCount is the number of relationship kinds constrained by the query.
	RelationshipKindCount int `json:"relationship_kind_count"`

	// UntypedRelationship reports whether the expansion permits any relationship kind.
	UntypedRelationship bool `json:"untyped_relationship"`

	// SuffixLength is the fixed terminal suffix length for fixed-suffix expansions.
	SuffixLength int `json:"suffix_length,omitempty"`

	// CandidateStrategy is the eligible optimizer strategy for this shape.
	CandidateStrategy string `json:"candidate_strategy,omitempty"`

	// Fingerprint is the stable digest of the fields that define this shape.
	Fingerprint string `json:"fingerprint"`
}

TraversalShape describes one statically classified shortest-path target. A zero value means the query is not in the initial structural selector scope.

func (TraversalShape) Available added in v1.0.0

func (s TraversalShape) Available() bool

Available reports whether the classifier found exactly one initial-scope traversal target. Multiple targets remain on the incumbent until a later selector version defines their joint semantics.

type TraversalShapeCacheProvider added in v1.0.0

type TraversalShapeCacheProvider interface {
	// TraversalShapeFor returns a cached classification or calls classify to produce one.
	TraversalShapeFor(query string, classify func() (TraversalShape, error)) (TraversalShape, error)
}

TraversalShapeCacheProvider optionally retains bounded, query-text-free structural classifications. It must invalidate every entry with schema generation changes and may always bypass retention safely.

type TraversalShapeCacheStats added in v1.0.0

type TraversalShapeCacheStats struct {
	// Hits counts classifications served from the bounded shape cache.
	Hits uint64 `json:"hits"`

	// Misses counts classifications computed without a retained entry.
	Misses uint64 `json:"misses"`

	// Entries is the number of retained query-digest classifications.
	Entries int `json:"entries"`

	// Capacity bounds retained classifications.
	Capacity int `json:"capacity"`
}

TraversalShapeCacheStats describes V2's bounded, query-text-free structural classification cache. Entries retain only a digest and immutable shape.

type TraversalStrategySelection added in v1.0.0

type TraversalStrategySelection struct {
	// Shape is the classified traversal structure considered for selection.
	Shape TraversalShape `json:"shape"`

	// PolicyGeneration identifies the active traversal-policy generation.
	PolicyGeneration uint64 `json:"policy_generation"`

	// SelectorVersion identifies the selection protocol evaluated for the query.
	SelectorVersion string `json:"selector_version"`

	// Candidate names the strategy that could replace the incumbent.
	Candidate string `json:"candidate"`

	// SelectedArm identifies the candidate or incumbent path that was selected.
	SelectedArm string `json:"selected_arm"`

	// Fallback identifies the incumbent strategy used when the candidate is not selected.
	Fallback string `json:"fallback"`

	// Bucket identifies the manifest bucket that authorized the selection, when any.
	Bucket string `json:"bucket,omitempty"`

	// TemplateSHA256 identifies the approved SQL template used by the selected bucket.
	TemplateSHA256 string `json:"template_sha256,omitempty"`

	// Mode identifies the selection mechanism that produced the decision.
	Mode string `json:"mode"`

	// Reason records the query-text-free rationale for the decision.
	Reason string `json:"reason"`
}

TraversalStrategySelection is query-text-free selection telemetry. It observes policy routing without retaining a decision outside the query.

type TraversalStrategySelectionCollector added in v1.0.0

type TraversalStrategySelectionCollector interface {
	// RecordTraversalStrategySelection receives query-text-free routing telemetry.
	RecordTraversalStrategySelection(TraversalStrategySelection)
}

TraversalStrategySelectionCollector is an optional diagnostic seam. It is intentionally separate from translation caching and cannot alter routing.

type TraversalTopologySynopsis added in v1.0.0

type TraversalTopologySynopsis struct {
	// GraphID identifies the graph summarized by this record.
	GraphID int32 `json:"graph_id"`

	// Epoch identifies this atomically published synopsis generation.
	Epoch uint64 `json:"epoch"`

	// SourceMutationEpoch is the graph mutation epoch observed while building the synopsis.
	SourceMutationEpoch uint64 `json:"source_mutation_epoch"`

	// CurrentMutationEpoch is the graph mutation epoch visible when the synopsis was read.
	CurrentMutationEpoch uint64 `json:"current_mutation_epoch"`

	// EstimatorVersion identifies the fixed estimator whose assumptions produced the synopsis.
	EstimatorVersion string `json:"estimator_version"`

	// SchemaVersion identifies the synopsis storage schema used to publish this record.
	SchemaVersion string `json:"schema_version"`

	// Status reports whether publication completed successfully.
	Status string `json:"status"`

	// NodeCount is the graph's node count recorded by the refresh.
	NodeCount int64 `json:"node_count"`

	// EdgeCount is the graph's edge count recorded by the refresh.
	EdgeCount int64 `json:"edge_count"`
}

TraversalTopologySynopsis is the current graph-scoped, atomically published topology summary. It is advisory only: callers must treat unavailable or stale state as an incumbent-only routing outcome.

func (TraversalTopologySynopsis) Available added in v1.0.0

func (s TraversalTopologySynopsis) Available() bool

Available reports whether this synopsis was atomically published for the current visible graph mutation epoch.

type TraversalWorkspaceStats added in v1.0.0

type TraversalWorkspaceStats struct {
	// Initializations counts successful workspace setup operations.
	Initializations uint64 `json:"initializations"`

	// Reuses counts requests served by a workspace ready in the current generation.
	Reuses uint64 `json:"reuses"`

	// Failures counts workspace setup attempts rejected by PostgreSQL.
	Failures uint64 `json:"failures"`

	// Ready reports whether the workspace is ready for the current schema generation.
	Ready bool `json:"ready"`
}

TraversalWorkspaceStats describes setup activity for session-local stable-snapshot traversal workspaces without exposing backend identity.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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