blob

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// CollectionBLOBs represents BLOBs collection
	CollectionBLOBs = "blobs"
)

Variables

This section is empty.

Functions

func UpsertUser

func UpsertUser(identity users.Identity, email string) (*storage.APIKey, error)

UpsertUser upserts user that is allowed to read/write on blobs

Types

type Envelope

type Envelope struct {
	// SizeBytes is the BLOB size in bytes
	SizeBytes int64 `json:"size_bytes"`
	// SHA512 is the half SHA512 hash of the BLOB
	SHA512 string `json:"sha512"`
	// Modified specifies the time this file was last modified
	Modified time.Time `json:"modified"`
}

Envelope specifies the metadata about BLOB - it's SHA512 hash and size

func (Envelope) String

func (r Envelope) String() string

String returns text representation of this blob envelope

type Objects

type Objects interface {
	io.Closer
	// WriteBLOB writes BLOB to storage, on success
	// returns the envelope with hash of the blob
	WriteBLOB(data io.Reader) (*Envelope, error)
	// OpenBLOB opens the BLOB by hash and returns reader object
	OpenBLOB(hash string) (ReadSeekCloser, error)
	// DeleteBLOB deletes the blob by hash
	DeleteBLOB(hash string) error
	// GetBLOBs returns blobs list present in the store
	GetBLOBs() ([]string, error)
	// GetBLOBEnvelope returns BLOB envelope
	GetBLOBEnvelope(hash string) (*Envelope, error)
}

Objects is a large BLOB Object storage implemented by some backends

func WithPermissions

func WithPermissions(objects Objects, users users.Users, username string, checker teleservices.AccessChecker) Objects

WithPermissions returns new ACL checking service

type ObjectsACL

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

ObjectsACL is permission aware service that wraps regular service and applies checks before every operation

func (*ObjectsACL) Close

func (a *ObjectsACL) Close() error

func (*ObjectsACL) DeleteBLOB

func (a *ObjectsACL) DeleteBLOB(hash string) error

DeleteBLOB deletes the blob by hash

func (*ObjectsACL) GetBLOBEnvelope

func (a *ObjectsACL) GetBLOBEnvelope(hash string) (*Envelope, error)

GetBLOBEnvelope returns blob envelope

func (*ObjectsACL) GetBLOBs

func (a *ObjectsACL) GetBLOBs() ([]string, error)

GetBLOBs returns blobs list present in the store

func (*ObjectsACL) OpenBLOB

func (a *ObjectsACL) OpenBLOB(hash string) (ReadSeekCloser, error)

OpenBLOB opens the BLOB by hash and returns reader object

func (*ObjectsACL) WriteBLOB

func (a *ObjectsACL) WriteBLOB(data io.Reader) (*Envelope, error)

WriteBLOB writes BLOB to storage, on success returns the envelope with hash of the blob

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

ReadSeekCloser implements Reader, Seeker and Closer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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