snapshotoffload

package
v0.0.0-...-0febee4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestSchemaVersion = 1
)

Variables

View Source
var (
	ErrInvalidOptions = errors.New("snapshot offload: invalid options")
	ErrIntegrity      = errors.New("snapshot offload: integrity check failed")
	ErrObjectConflict = errors.New("snapshot offload: object conflict")
	ErrObjectNotFound = errors.New("snapshot offload: object not found")
)

Functions

func ValidateKMSKeyID

func ValidateKMSKeyID(value string) error

ValidateKMSKeyID accepts canonical key ARNs and bare key IDs. Aliases are rejected because S3 reports the resolved key identity, not the alias string.

func ValidateS3StoreEncryption

func ValidateS3StoreEncryption(encryption, kmsKeyID string) error

Types

type LocalStore

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

func NewLocalStore

func NewLocalStore(root string) (*LocalStore, error)

func (*LocalStore) GetObject

func (s *LocalStore) GetObject(ctx context.Context, key string) (io.ReadCloser, ObjectInfo, error)

func (*LocalStore) HeadObject

func (s *LocalStore) HeadObject(ctx context.Context, key string) (ObjectInfo, bool, error)

func (*LocalStore) PutObject

func (s *LocalStore) PutObject(ctx context.Context, key string, body io.Reader, opts PutOptions) (ObjectInfo, error)

type Manifest

type Manifest struct {
	SchemaVersion  int               `json:"schema_version"`
	CreatedAt      time.Time         `json:"created_at"`
	SourceCluster  string            `json:"source_cluster,omitempty"`
	GroupID        uint64            `json:"group_id"`
	SnapshotIndex  uint64            `json:"snapshot_index"`
	SnapshotTerm   uint64            `json:"snapshot_term"`
	ConfState      ManifestConfState `json:"conf_state"`
	Payload        PayloadDescriptor `json:"payload"`
	BinaryVersion  string            `json:"binary_version,omitempty"`
	ManifestKey    string            `json:"manifest_key"`
	ManifestSHA256 string            `json:"manifest_sha256,omitempty"`
}

func DecodeManifest

func DecodeManifest(data []byte) (Manifest, error)

func LoadManifest

func LoadManifest(ctx context.Context, store ObjectStore, key string) (Manifest, error)

func PublishPersistedSnapshot

func PublishPersistedSnapshot(ctx context.Context, opts PublishOptions) (*Manifest, error)

func (Manifest) MarshalCanonical

func (m Manifest) MarshalCanonical() ([]byte, string, error)

type ManifestConfState

type ManifestConfState struct {
	Voters         []uint64 `json:"voters,omitempty"`
	Learners       []uint64 `json:"learners,omitempty"`
	VotersOutgoing []uint64 `json:"voters_outgoing,omitempty"`
	LearnersNext   []uint64 `json:"learners_next,omitempty"`
	AutoLeave      bool     `json:"auto_leave,omitempty"`
}

type ObjectInfo

type ObjectInfo struct {
	Key  string
	Size int64
	// SHA256 is optional for metadata-only Head/Get paths; PutObject returns it
	// when the writer verified the committed content.
	SHA256               string
	ServerSideEncryption string
	SSEKMSKeyID          string
}

type ObjectStore

type ObjectStore interface {
	PutObject(ctx context.Context, key string, body io.Reader, opts PutOptions) (ObjectInfo, error)
	GetObject(ctx context.Context, key string) (io.ReadCloser, ObjectInfo, error)
	HeadObject(ctx context.Context, key string) (ObjectInfo, bool, error)
}

type PayloadDescriptor

type PayloadDescriptor struct {
	Key          string `json:"key"`
	Bytes        int64  `json:"bytes"`
	SHA256       string `json:"sha256"`
	SourceCRC32C uint32 `json:"source_crc32c"`
}

type PublishOptions

type PublishOptions struct {
	Store         ObjectStore
	DataDir       string
	Prefix        string
	GroupID       uint64
	SourceCluster string
	BinaryVersion string
	CreatedAt     time.Time
	SpoolDir      string
}

type PutOptions

type PutOptions struct {
	Size        int64
	SHA256      string
	ContentType string
}

type RestoreOptions

type RestoreOptions struct {
	Store       ObjectStore
	ManifestKey string
	Manifest    *Manifest
	DataDir     string
	Peers       []etcdraftengine.Peer
}

type S3Store

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

func NewS3Store

func NewS3Store(ctx context.Context, cfg S3StoreConfig) (*S3Store, error)

func (*S3Store) GetObject

func (s *S3Store) GetObject(ctx context.Context, key string) (io.ReadCloser, ObjectInfo, error)

func (*S3Store) HeadObject

func (s *S3Store) HeadObject(ctx context.Context, key string) (ObjectInfo, bool, error)

func (*S3Store) PutObject

func (s *S3Store) PutObject(ctx context.Context, key string, body io.Reader, opts PutOptions) (ObjectInfo, error)

type S3StoreConfig

type S3StoreConfig struct {
	Client                 S3ObjectClient
	Bucket                 string
	Region                 string
	Endpoint               string
	Profile                string
	ForcePathStyle         bool
	AccessKeyID            string
	SecretAccessKey        string
	SessionToken           string
	ServerSideEncryption   string
	SSEKMSKeyID            string
	DisableChecksumHeaders bool
}

Jump to

Keyboard shortcuts

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