snapshot

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Overview

Package snapshot creates sanitized runtime snapshots for inspection and diff.

Index

Constants

View Source
const SchemaVersion = 1

SchemaVersion is the snapshot document schema.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffEntry

type DiffEntry struct {
	Path string `json:"path"`
	From any    `json:"from,omitempty"`
	To   any    `json:"to,omitempty"`
	Op   string `json:"op"` // add|remove|change
}

DiffEntry describes one changed path.

func Diff

func Diff(a, b Snapshot) []DiffEntry

Diff compares two snapshots' Data maps.

type Snapshot

type Snapshot struct {
	SchemaVersion int               `json:"schema_version"`
	CreatedAt     time.Time         `json:"created_at"`
	Service       string            `json:"service,omitempty"`
	InstanceID    string            `json:"instance_id,omitempty"`
	ContentHash   string            `json:"content_hash"`
	Data          map[string]any    `json:"data"`
	Labels        map[string]string `json:"labels,omitempty"`
}

Snapshot is a sanitized, hashable runtime view with no secrets.

func Create

func Create(service, instance string, data map[string]any, labels map[string]string) (Snapshot, error)

Create builds a snapshot from arbitrary data, redacting secrets and hashing content.

func (Snapshot) Marshal

func (s Snapshot) Marshal() ([]byte, error)

Marshal returns indented JSON.

Jump to

Keyboard shortcuts

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