ezblob

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelKeyManagedBy = "app.kubernetes.io/managed-by"
	LabelValManagedBy = "ezblob.guoyk93.github.io"
	LabelKeyComponent = "app.kubernetes.io/component"
	LabelValComponent = "chunk"
	LabelKeyName      = "guoyk93.github.io/ezblob-name"
	LabelKeyRevision  = "guoyk93.github.io/ezblob-revision"

	KeyName     = "name"
	KeyRevision = "revision"
	KeyChunks   = "chunks"
	KeyChecksum = "checksum"

	KeyData = "data"
)
View Source
const (
	DefaultChunkSize = 4096
)

Variables

View Source
var (
	ErrNotFound         = errors.New("not found")
	ErrChecksumMismatch = errors.New("checksum mismatch")

	ErrInvalidHeaderFieldName     = errors.New("missing or invalid field in header secret: 'name'")
	ErrInvalidHeaderFieldChecksum = errors.New("missing or invalid field in header secret: 'checksum'")
	ErrInvalidHeaderFieldRevision = errors.New("missing or invalid field in header secret: 'revision'")
	ErrInvalidHeaderFieldChunks   = errors.New("missing or invalid field in header secret: 'chunks'")
)

Functions

This section is empty.

Types

type Blob

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

func New

func New(opts Options) *Blob

New create a Blob / 创建一个 Blob

func (*Blob) Delete

func (bl *Blob) Delete(ctx context.Context) (err error)

func (*Blob) Load

func (bl *Blob) Load(ctx context.Context) (buf []byte, err error)

Load load all data from kubernetes secrets / 从 Kubernetes Secret 载入全部数据

func (*Blob) Save

func (bl *Blob) Save(ctx context.Context, buf []byte) (err error)

Save save data to kubernetes secrets / 把数据保存到 Kubernetes Secret

type Options

type Options struct {
	// Client kubernetes client / kubernetes 客户端
	Client *kubernetes.Clientset
	// Name Blob name, use as Secret name / Blob 名称,同时会用作 Secret 名
	Name string
	// Namespace kubernetes namespace / kubernetes 命名空间
	Namespace string
	// ChunkSize maximum size of each chunk / 最大分片大小
	ChunkSize int
}

Options options to create Blob / 创建 Blob 所需要的参数

Jump to

Keyboard shortcuts

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