store

package
v1.4.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncryptPlain = "plaintext"
	EncryptAes   = "aes256-ctr"
)

Variables

This section is empty.

Functions

func LoadEncryptionKey

func LoadEncryptionKey(encryptionMethod, keyFile string) ([]byte, error)

func NewReader

func NewReader(lg *zap.Logger, storage storage.ExternalStorage, cfg ReaderCfg) (*loader, error)

func NewStorage

func NewStorage(path string) (storage.ExternalStorage, error)

func NewWriter

func NewWriter(lg *zap.Logger, externalStorage storage.ExternalStorage, cfg WriterCfg) (io.WriteCloser, error)

NewWriter just wraps the rotate writer. It doesn't use a buffer because Capture writes data in a big batch. Capture uses a bytes buffer to encode commands and the buffer can not be replaced with a bufio.Writer.

func PreCheckMeta

func PreCheckMeta(externalStorage storage.ExternalStorage) error

Types

type Meta

type Meta struct {
	Version       string
	Duration      time.Duration
	Cmds          uint64
	FilteredCmds  uint64 `json:"FilteredCmds,omitempty"`
	EncryptMethod string `json:"EncryptMethod,omitempty"`
}

func NewMeta

func NewMeta(duration time.Duration, cmds, filteredCmds uint64, EncryptMethod string) *Meta

func (*Meta) Read

func (m *Meta) Read(externalStorage storage.ExternalStorage) error

func (*Meta) Write

func (m *Meta) Write(externalStorage storage.ExternalStorage) error

type Reader

type Reader interface {
	io.ReadCloser
	CurFile() string
}

type ReaderCfg

type ReaderCfg struct {
	Dir              string
	EncryptionMethod string
	EncryptionKey    []byte
}

type StorageWriter

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

func NewStorageWriter

func NewStorageWriter(writer storage.ExternalFileWriter) *StorageWriter

func (*StorageWriter) Close

func (s *StorageWriter) Close() error

func (*StorageWriter) Write

func (s *StorageWriter) Write(p []byte) (n int, err error)

type WriterCfg

type WriterCfg struct {
	Dir              string
	EncryptionMethod string
	EncryptionKey    []byte
	FileSize         int
	Compress         bool
}

Jump to

Keyboard shortcuts

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