snapshot

package
v0.70.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package snapshot provides immutable, compiled descriptor sets that are safe for concurrent access. A Snapshot is the unit of hot-swap: readers hold a reference to the current snapshot, and swaps atomically replace the pointer. Go's GC reclaims old snapshots when no readers remain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

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

Snapshot is an immutable, compiled view of a schema at a specific version. It is safe for concurrent use and must not be modified after creation.

func New

func New(version uint64, fds *descriptorpb.FileDescriptorSet) (*Snapshot, error)

New creates a Snapshot from a FileDescriptorSet. This is the fast path used during startup recovery — no protocompile invocation needed.

func NewFromFiles

func NewFromFiles(version uint64, fds []protoreflect.FileDescriptor) (*Snapshot, error)

NewFromFiles creates a Snapshot from already-resolved file descriptors. This is used after protocompile compilation.

func (*Snapshot) FileDescriptors

func (s *Snapshot) FileDescriptors() []protoreflect.FileDescriptor

FileDescriptors returns the list of file descriptors in this snapshot.

func (*Snapshot) Files

func (s *Snapshot) Files() *protoregistry.Files

Files returns the file descriptor registry.

func (*Snapshot) FindMessageByName

func (s *Snapshot) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageDescriptor, error)

FindMessageByName looks up a message descriptor by its fully-qualified name.

func (*Snapshot) NewMessage

func (s *Snapshot) NewMessage(name protoreflect.FullName) (*dynamicpb.Message, error)

NewMessage creates a new dynamic message instance by fully-qualified name.

func (*Snapshot) Types

func (s *Snapshot) Types() *protoregistry.Types

Types returns the type registry for dynamic message creation.

func (*Snapshot) Version

func (s *Snapshot) Version() uint64

Version returns the schema version this snapshot represents.

Jump to

Keyboard shortcuts

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