cluster

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: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	logrus.FieldLogger
	Config
	// contains filtered or unexported fields
}

Cluster is the distributed blob storage

func New

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

New returns cluster BLOB storage that takes care of replication of BLOBs across cluster of nodes. It is designed for small clusters O(10) and small amount of objects managed O(100)

func (*Cluster) Close

func (c *Cluster) Close() error

Close stops internal processes

func (*Cluster) DeleteBLOB

func (c *Cluster) DeleteBLOB(hash string) error

DeleteBLOB deletes BLOB from the storage

func (*Cluster) GetBLOBEnvelope

func (c *Cluster) GetBLOBEnvelope(hash string) (*blob.Envelope, error)

GetBLOBEnvelope returns the blob envelope for the given hash

func (*Cluster) GetBLOBs

func (c *Cluster) GetBLOBs() ([]string, error)

GetBLOBs returns a list of BLOBs in the storage

func (*Cluster) OpenBLOB

func (c *Cluster) OpenBLOB(hash string) (blob.ReadSeekCloser, error)

OpenBLOB opens file identified by hash and returns reader

func (*Cluster) Start

func (c *Cluster) Start()

Start starts internal processes

func (*Cluster) WriteBLOB

func (c *Cluster) WriteBLOB(data io.Reader) (*blob.Envelope, error)

WriteBLOB writes object to the storage, returns object envelope

type Config

type Config struct {
	// Local is a local BLOB storage managed by this peer
	Local blob.Objects
	// Backend is a discovery and metadata backend
	Backend storage.Backend
	// GetPeer returns new peer client based on ID
	GetPeer GetPeer
	// WriteFactor defines how many peer writes should be acknowledged
	// before write is considered successful
	WriteFactor int
	// ID is a peer local ID
	ID string
	// AdvertiseAddr is peer advertise address
	AdvertiseAddr string
	// Clock is clock interface, used in tests
	Clock clockwork.Clock
	// HeartbeatPeriod defines the period between heartbeats
	HeartbeatPeriod time.Duration
	// MissedHeartbeats is how many heartbeats the peer
	// should miss before we consider it closed
	MissedHeartbeats int
	// GracePeriod is a period for GC not to delete undetected files
	// to prevent accidental deletion. Defaults to 1 hour
	GracePeriod time.Duration
}

Config is a cluster BLOB storage configuration

type GetPeer

type GetPeer func(peer storage.Peer) (blob.Objects, error)

GetPeer returns a new client peer for Object storage

Jump to

Keyboard shortcuts

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