asb

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder[T models.TokenConstraint] struct {
	// contains filtered or unexported fields
}

Decoder contains logic for decoding backup data from the .asb format.

func NewDecoder

func NewDecoder[T models.TokenConstraint](src io.Reader, fileName string, ignoreUnknownFields bool, logger *slog.Logger,
) (*Decoder[T], error)

NewDecoder creates a new Decoder.

func (*Decoder[T]) NextToken

func (r *Decoder[T]) NextToken() (T, error)

type Encoder

type Encoder[T models.TokenConstraint] struct {
	// contains filtered or unexported fields
}

Encoder contains logic for encoding backup data into the .asb format. This is a stateful object that must be created for every backup operation.

func NewEncoder

func NewEncoder[T models.TokenConstraint](cfg *EncoderConfig) *Encoder[T]

NewEncoder creates a new Encoder.

func (*Encoder[T]) EncodeToken

func (e *Encoder[T]) EncodeToken(token T) ([]byte, error)

EncodeToken encodes a token to the ASB format. It returns a byte slice of the encoded token and an error if the encoding fails.

func (*Encoder[T]) GenerateFilename

func (e *Encoder[T]) GenerateFilename(prefix, suffix string) string

GenerateFilename generates a file name for the given namespace.

func (*Encoder[T]) GetHeader

func (e *Encoder[T]) GetHeader(_ uint64, isMeta bool) []byte

type EncoderConfig added in v0.8.0

type EncoderConfig struct {
	// Namespace is the namespace to back up.
	Namespace string
	// Do not apply base-64 encoding to BLOBs: Bytes, HLL, RawMap, RawList.
	Compact bool
	// HasExpressionSIndex indicates whether the backup contains an expression SIndex.
	// In that case an asb metaVersion will be bumped.
	HasExpressionSIndex bool
}

EncoderConfig contains configuration options for the Encoder.

func NewEncoderConfig added in v0.8.0

func NewEncoderConfig(namespace string, compact, hasExpressionSIndex bool) *EncoderConfig

NewEncoderConfig returns a new encoder EncoderConfig.

type UserKeyTypesInt

type UserKeyTypesInt interface {
	int64 | int32 | int16 | int8 | int
}

type Validator

type Validator struct {
}

Validator represents backup files validator.

func NewValidator

func NewValidator() *Validator

NewValidator returns new validator instance for files validation.

func (*Validator) Run

func (v *Validator) Run(fileName string) error

Run performs backup files validation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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