Documentation
¶
Overview ¶
Package schema owns the record serialization layer and its schema-versioned message definitions used by the graph store.
Index ¶
- Constants
- Variables
- func IsCurrentSchemaVersion(m *Meta) bool
- type Edge
- func (*Edge) Descriptor() ([]byte, []int)deprecated
- func (x *Edge) GetCol() int32
- func (x *Edge) GetKind() string
- func (x *Edge) GetLine() int32
- func (x *Edge) GetMetadata() map[string]string
- func (x *Edge) GetProvenance() string
- func (x *Edge) GetSource() string
- func (x *Edge) GetTarget() string
- func (*Edge) ProtoMessage()
- func (x *Edge) ProtoReflect() protoreflect.Message
- func (x *Edge) Reset()
- func (x *Edge) String() string
- type File
- func (*File) Descriptor() ([]byte, []int)deprecated
- func (x *File) GetContentHash() string
- func (x *File) GetEdgeCount() int64
- func (x *File) GetErrors() []string
- func (x *File) GetLanguage() string
- func (x *File) GetMtimeUnixNs() int64
- func (x *File) GetNodeCount() int64
- func (x *File) GetPath() string
- func (x *File) GetSizeBytes() int64
- func (*File) ProtoMessage()
- func (x *File) ProtoReflect() protoreflect.Message
- func (x *File) Reset()
- func (x *File) String() string
- type Meta
- func (*Meta) Descriptor() ([]byte, []int)deprecated
- func (x *Meta) GetEdgeCount() int64
- func (x *Meta) GetHasFileIndex() bool
- func (x *Meta) GetHealthMessage() string
- func (x *Meta) GetHealthy() bool
- func (x *Meta) GetLastSyncUnixMs() int64
- func (x *Meta) GetNodeCount() int64
- func (x *Meta) GetSchemaVersion() uint32
- func (*Meta) ProtoMessage()
- func (x *Meta) ProtoReflect() protoreflect.Message
- func (x *Meta) Reset()
- func (x *Meta) String() string
- type Node
- func (*Node) Descriptor() ([]byte, []int)deprecated
- func (x *Node) GetDocstring() string
- func (x *Node) GetEndCol() int32
- func (x *Node) GetEndLine() int32
- func (x *Node) GetFilePath() string
- func (x *Node) GetId() string
- func (x *Node) GetIsExported() bool
- func (x *Node) GetKind() string
- func (x *Node) GetLanguage() string
- func (x *Node) GetName() string
- func (x *Node) GetQualifiedName() string
- func (x *Node) GetReturnType() string
- func (x *Node) GetSignature() string
- func (x *Node) GetStartCol() int32
- func (x *Node) GetStartLine() int32
- func (x *Node) GetVisibility() string
- func (*Node) ProtoMessage()
- func (x *Node) ProtoReflect() protoreflect.Message
- func (x *Node) Reset()
- func (x *Node) String() string
Constants ¶
const SchemaVersion uint32 = 1
SchemaVersion is the current on-disk schema version stamped into every Meta record (D-02).
Additive-only discipline (D-02a): within a single SchemaVersion, fields on Node, Edge, File, and Meta are NEVER renumbered or reused. Retiring a field means adding its number to a `reserved` clause in graph.proto, not deleting or repurposing it. SchemaVersion itself is bumped ONLY when a genuinely breaking layout change is unavoidable — a well-formed additive change (a new field, a newly reserved range) never requires a bump.
Variables ¶
var File_internal_schema_graph_proto protoreflect.FileDescriptor
Functions ¶
func IsCurrentSchemaVersion ¶
IsCurrentSchemaVersion reports whether m carries the schema version this build of codegraph-go was compiled against. A record with an older version is expected to still decode (protobuf's forward/backward compatibility, ARCH-01) but callers that need to gate on version drift can use this helper rather than comparing SchemaVersion inline.
Types ¶
type Edge ¶
type Edge struct {
Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"`
// Optional call-site coordinates. Per RESEARCH Pitfall 2 / Open Question
// 3: the Pebble edge KEY (`e/<src>/<kind>/<dst>`, D-03) intentionally
// omits line/col today, so two call sites between the same (source,
// kind, target) collapse to one stored edge. That key-identity decision
// is deferred to Phase 2 extractor design — this record must still be
// able to CARRY line/col so a future key-shape change (or an
// annotation/audit trail) doesn't lose the data that's available at
// extraction time.
Line int32 `protobuf:"varint,4,opt,name=line,proto3" json:"line,omitempty"`
Col int32 `protobuf:"varint,5,opt,name=col,proto3" json:"col,omitempty"`
// provenance records how this edge was derived. Phase 2 writes only
// ground-truth values ("ast" or empty) per D-03a; "heuristic" provenance
// (fuzzy/inferred edges) is Phase 5's addition, not written here.
Provenance string `protobuf:"bytes,6,opt,name=provenance,proto3" json:"provenance,omitempty"`
// metadata is an open extension bag for edge-kind-specific extractor
// annotations that do not warrant their own field yet. Additive schema
// field (D-03).
Metadata map[string]string `` /* 143-byte string literal not displayed */
// contains filtered or unexported fields
}
Edge is a directed relationship between two Node ids (calls, imports, implements, etc.).
func (*Edge) Descriptor
deprecated
func (*Edge) GetMetadata ¶
func (*Edge) GetProvenance ¶
func (*Edge) ProtoMessage ¶
func (*Edge) ProtoMessage()
func (*Edge) ProtoReflect ¶
func (x *Edge) ProtoReflect() protoreflect.Message
type File ¶
type File struct {
Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`
// content_hash MUST be a collision-resistant hash (SHA-256 — see
// Security Domain V6 in 01-RESEARCH.md), never a weak hash like MD5.
// The hash computation itself lands with the Phase 2 indexer; this
// field only defines its storage shape.
ContentHash string `protobuf:"bytes,2,opt,name=content_hash,json=contentHash,proto3" json:"content_hash,omitempty"`
Language string `protobuf:"bytes,3,opt,name=language,proto3" json:"language,omitempty"`
NodeCount int64 `protobuf:"varint,4,opt,name=node_count,json=nodeCount,proto3" json:"node_count,omitempty"`
EdgeCount int64 `protobuf:"varint,5,opt,name=edge_count,json=edgeCount,proto3" json:"edge_count,omitempty"`
// errors records per-file extraction failures (e.g. oversized or
// unparseable source) so one bad file does not abort the whole index run
// (RESEARCH Assumptions Log A2, Pitfall 4). Additive extension of D-03's
// File record.
Errors []string `protobuf:"bytes,6,rep,name=errors,proto3" json:"errors,omitempty"`
// mtime_unix_ns is the file's on-disk modification time (nanoseconds
// since epoch) as observed by the writer. Additive Phase-4 field
// (D-01a); written by both `index` and `sync` so the incremental sync
// engine's stat pre-filter can cheaply shortlist changed files before
// paying for a content_hash recompute.
MtimeUnixNs int64 `protobuf:"varint,7,opt,name=mtime_unix_ns,json=mtimeUnixNs,proto3" json:"mtime_unix_ns,omitempty"`
// size_bytes is the file's on-disk size in bytes as observed by the
// writer. Additive Phase-4 field (D-01a); written by both `index` and
// `sync` alongside mtime_unix_ns for the same stat pre-filter.
SizeBytes int64 `protobuf:"varint,8,opt,name=size_bytes,json=sizeBytes,proto3" json:"size_bytes,omitempty"`
// contains filtered or unexported fields
}
File is a per-source-file record: identity, content hash, and aggregate counts for the symbols/edges attributed to it.
func (*File) Descriptor
deprecated
func (*File) GetContentHash ¶
func (*File) GetEdgeCount ¶
func (*File) GetLanguage ¶
func (*File) GetMtimeUnixNs ¶
func (*File) GetNodeCount ¶
func (*File) GetSizeBytes ¶
func (*File) ProtoMessage ¶
func (*File) ProtoMessage()
func (*File) ProtoReflect ¶
func (x *File) ProtoReflect() protoreflect.Message
type Meta ¶
type Meta struct {
SchemaVersion uint32 `protobuf:"varint,1,opt,name=schema_version,json=schemaVersion,proto3" json:"schema_version,omitempty"`
NodeCount int64 `protobuf:"varint,2,opt,name=node_count,json=nodeCount,proto3" json:"node_count,omitempty"`
EdgeCount int64 `protobuf:"varint,3,opt,name=edge_count,json=edgeCount,proto3" json:"edge_count,omitempty"`
LastSyncUnixMs int64 `protobuf:"varint,4,opt,name=last_sync_unix_ms,json=lastSyncUnixMs,proto3" json:"last_sync_unix_ms,omitempty"`
Healthy bool `protobuf:"varint,5,opt,name=healthy,proto3" json:"healthy,omitempty"`
HealthMessage string `protobuf:"bytes,6,opt,name=health_message,json=healthMessage,proto3" json:"health_message,omitempty"`
// has_file_index reports whether this graph's on-disk store has been
// populated with the Phase-4 `x/` file-owned secondary index (D-02).
// Additive Phase-4 field (D-02b); false means a pre-Phase-4 graph that
// lacks the index, signaling `sync` to perform a one-time full
// re-index backfill before switching to incremental updates.
HasFileIndex bool `protobuf:"varint,7,opt,name=has_file_index,json=hasFileIndex,proto3" json:"has_file_index,omitempty"`
// contains filtered or unexported fields
}
Meta is the single versioned record (stored under the `meta/` key prefix, D-03) that stamps the on-disk schema version plus aggregate counts and index health. schema_version is bumped ONLY for a genuinely breaking layout change — additive field changes never require a bump (D-02a).
func NewMeta ¶
func NewMeta() *Meta
NewMeta returns a Meta record stamped with the current SchemaVersion. Callers should use this instead of constructing a Meta literal directly, so a SchemaVersion bump only needs to change in one place.
func (*Meta) Descriptor
deprecated
func (*Meta) GetEdgeCount ¶
func (*Meta) GetHasFileIndex ¶
func (*Meta) GetHealthMessage ¶
func (*Meta) GetHealthy ¶
func (*Meta) GetLastSyncUnixMs ¶
func (*Meta) GetNodeCount ¶
func (*Meta) GetSchemaVersion ¶
func (*Meta) ProtoMessage ¶
func (*Meta) ProtoMessage()
func (*Meta) ProtoReflect ¶
func (x *Meta) ProtoReflect() protoreflect.Message
type Node ¶
type Node struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
QualifiedName string `protobuf:"bytes,4,opt,name=qualified_name,json=qualifiedName,proto3" json:"qualified_name,omitempty"`
FilePath string `protobuf:"bytes,5,opt,name=file_path,json=filePath,proto3" json:"file_path,omitempty"`
Language string `protobuf:"bytes,6,opt,name=language,proto3" json:"language,omitempty"`
StartLine int32 `protobuf:"varint,7,opt,name=start_line,json=startLine,proto3" json:"start_line,omitempty"`
EndLine int32 `protobuf:"varint,8,opt,name=end_line,json=endLine,proto3" json:"end_line,omitempty"`
StartCol int32 `protobuf:"varint,9,opt,name=start_col,json=startCol,proto3" json:"start_col,omitempty"`
EndCol int32 `protobuf:"varint,10,opt,name=end_col,json=endCol,proto3" json:"end_col,omitempty"`
// signature is the extractor-rendered parameter/return signature string
// (e.g. "func(a int, b string) error"). Additive schema field (D-03);
// written by the Phase 2 goextract symbol pass.
Signature string `protobuf:"bytes,11,opt,name=signature,proto3" json:"signature,omitempty"`
// docstring is the leading comment/doc block attached to the symbol, as
// captured verbatim by the extractor. Additive schema field (D-03);
// written by the Phase 2 goextract symbol pass.
Docstring string `protobuf:"bytes,12,opt,name=docstring,proto3" json:"docstring,omitempty"`
// visibility is the language-level access modifier ("public", "private",
// "package", etc.) as classified by the extractor. Additive schema
// field (D-03); written by the Phase 2 goextract symbol pass.
Visibility string `protobuf:"bytes,13,opt,name=visibility,proto3" json:"visibility,omitempty"`
// is_exported reports whether the symbol crosses the package/module
// boundary (Go: identifier starts uppercase). Additive schema field
// (D-03); written by the Phase 2 goextract symbol pass.
IsExported bool `protobuf:"varint,14,opt,name=is_exported,json=isExported,proto3" json:"is_exported,omitempty"`
// return_type is the extractor-rendered return type string, when the
// symbol kind has one (function/method). Additive schema field
// (D-03); written by the Phase 2 goextract symbol pass.
ReturnType string `protobuf:"bytes,15,opt,name=return_type,json=returnType,proto3" json:"return_type,omitempty"`
// contains filtered or unexported fields
}
Node is a single symbol record (function, type, method, etc.) extracted from a source file.
NOTE: field names/types are designed against the TS `.codegraph/` DDL captured in Plan 01-04. If 01-04 has not landed by the time this is read, reconcile these fields against the captured DDL once it is available — additively only, per D-02a.
func (*Node) Descriptor
deprecated
func (*Node) GetDocstring ¶
func (*Node) GetEndLine ¶
func (*Node) GetFilePath ¶
func (*Node) GetIsExported ¶
func (*Node) GetLanguage ¶
func (*Node) GetQualifiedName ¶
func (*Node) GetReturnType ¶
func (*Node) GetSignature ¶
func (*Node) GetStartCol ¶
func (*Node) GetStartLine ¶
func (*Node) GetVisibility ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
func (*Node) ProtoReflect ¶
func (x *Node) ProtoReflect() protoreflect.Message