remote

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package remote owns protected remote snapshot access. Provider adapters feed FileStore in Spec 009 without changing Plan's input contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

func OpenFileStore

func OpenFileStore(workspace string) *FileStore

func (*FileStore) Current

func (s *FileStore) Current(environmentID string) (Snapshot, error)

func (*FileStore) Save

func (s *FileStore) Save(environmentID string, snapshot Snapshot) error

Save writes an atomically replaced protected file. Callers only invoke it after a complete successful pull, so a failed read never changes the cache.

type Snapshot

type Snapshot struct {
	Status            string            `json:"status"`
	RemoteETag        string            `json:"remote_etag,omitempty"`
	Version           string            `json:"version,omitempty"`
	ObservedAt        time.Time         `json:"observed_at,omitempty"`
	Summary           *Summary          `json:"summary,omitempty"`
	UnavailableReason UnavailableReason `json:"unavailable_reason,omitempty"`
	Parameters        map[string]any    `json:"-"`
	// Template is protected provider data. It is persisted with mode 0600 and
	// deliberately excluded from normal API and Plan response serialization.
	Template json.RawMessage `json:"-"`
}

func SnapshotFromTemplate

func SnapshotFromTemplate(template []byte, etag, version string, observedAt time.Time) (Snapshot, error)

SnapshotFromTemplate derives the provider-neutral data Plan requires without exposing the Firebase template through normal read models.

type SnapshotStore

type SnapshotStore interface {
	Current(environmentID string) (Snapshot, error)
}

SnapshotStore is the stable Plan-facing remote snapshot contract.

type Store

type Store = SnapshotStore

type Summary

type Summary struct {
	ParameterCount        int `json:"parameter_count"`
	ManagedParameterCount int `json:"managed_parameter_count"`
	ConditionCount        int `json:"condition_count"`
	// HasUnmodeledConditions is set by the snapshot reader until Spec 009
	// supplies condition-level Firebase Remote Config data for comparison.
	HasUnmodeledConditions bool `json:"-"`
	// These observations are provider-internal comparison facts. They are not
	// serialized in the public RemoteSummary contract and never contain values.
	HasUnknownParameters    bool   `json:"-"`
	HasStructuralDifference bool   `json:"-"`
	ContentDigest           string `json:"content_digest"`
}

type UnavailableReason

type UnavailableReason string
const (
	ProviderUnavailable   UnavailableReason = "provider_unavailable"
	ProviderUnauthorized  UnavailableReason = "provider_unauthorized"
	SnapshotMissing       UnavailableReason = "remote_snapshot_missing"
	CapabilityUnavailable UnavailableReason = "provider_capability_unavailable"
)

Jump to

Keyboard shortcuts

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