blobstore

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxBlobBytes  int64 = 4 << 30
	DefaultMaxTotalBytes int64 = 16 << 30
	DefaultMaxBlobs            = 4096
	DefaultMaxNameBytes        = 255
	DefaultTTL                 = 30 * time.Minute
)

Variables

View Source
var (
	// ErrResourceExhausted identifies a store quota failure to transport layers.
	ErrResourceExhausted = errors.New("blob store resource limit exceeded")
	ErrInvalidArgument   = errors.New("invalid blob argument")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Directory     string
	MaxBlobBytes  int64
	MaxTotalBytes int64
	MaxBlobs      int
	MaxNameBytes  int
	TTL           time.Duration
}

type File

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

func (*File) Close

func (f *File) Close() error

func (*File) Read

func (f *File) Read(p []byte) (int, error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

type Metadata

type Metadata struct {
	ID        string
	Name      string
	Size      int64
	SHA256    string
	CreatedAt time.Time
	ExpiresAt time.Time
}

type Store

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

func New

func New(config Config) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(id string) (bool, error)

Delete marks a blob unavailable immediately. Its quota is released only after all open handles close and the underlying file is removed successfully.

func (*Store) Limits

func (s *Store) Limits() (maxBlobBytes, maxTotalBytes int64)

func (*Store) Metadata

func (s *Store) Metadata(id string) (Metadata, error)

func (*Store) ObjectLimits

func (s *Store) ObjectLimits() (maxBlobs, maxNameBytes int)

func (*Store) Open

func (s *Store) Open(id string) (*File, Metadata, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, name string, reader io.Reader) (Metadata, error)

Jump to

Keyboard shortcuts

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