asbx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: Apache-2.0 Imports: 9 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 binary .asbx format. This is a stateful object that should be created for each file being decoded.

func NewDecoder

func NewDecoder[T models.TokenConstraint](r io.Reader, fileNumber uint64, filename string) (*Decoder[T], error)

NewDecoder creates a new Decoder that reads from the provided io.Reader.

func (*Decoder[T]) NextToken

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

NextToken reads and decodes the next token from the file. It returns the decoded token and any error that occurred. io.EOF is returned when the end of the file is reached.

type Encoder

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

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

func NewEncoder

func NewEncoder[T models.TokenConstraint](namespace string) *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 ASBX 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. Empty values are used to implement Encoder interface.

func (*Encoder[T]) GetHeader

func (e *Encoder[T]) GetHeader(fileNumber uint64) []byte

GetHeader returns prepared file header as []byte.

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.

Jump to

Keyboard shortcuts

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