v0.0.0-...-ea0be71 Latest Latest

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 6 Imported by: 0




View Source
const (
	BlobSize = 4 * mebibyte

	NoParentId = ""


View Source
var (
	ErrBlobNotAccessibleOnThisNode = errors.New("blob not accessible on this node")


This section is empty.


type Blob

type Blob struct {
	Ref                       BlobRef
	EncryptionKeyId           string
	Volumes                   []int
	VolumesPendingReplication []int
	Referenced                bool // aborted uploads (ones that do not get referenced by a commit) could leave orphaned blobs
	IsCompressed              bool
	Size                      int32 // 32 bits is enough, usually blobs are 4 MB
	SizeOnDisk                int32 // after optional compression
	Crc32                     []byte

type BlobRef

type BlobRef []byte

func BlobRefFromBytes

func BlobRefFromBytes(bytes []byte) (*BlobRef, error)

func BlobRefFromHex

func BlobRefFromHex(serialized string) (*BlobRef, error)

func (*BlobRef) AsHex

func (b *BlobRef) AsHex() string

func (*BlobRef) AsSha256Sum

func (b *BlobRef) AsSha256Sum() []byte

func (*BlobRef) Equal

func (b *BlobRef) Equal(other BlobRef) bool

type Client

type Client struct {
	ID        string
	Created   time.Time
	AuthToken string
	Name      string

type Collection

type Collection struct {
	ID                string
	Created           time.Time // earliest of all changesets' file create/update timestamps
	Directory         string
	Name              string
	Description       string
	Sensitivity       int           // 0(for all eyes) 1(a bit sensitive) 2(for my eyes only)
	ReplicationPolicy string        // [calculated] effective policy inherited from parent directory
	Head              string        // points to the head changeset. unset only for empty collections
	EncryptionKeys    []KeyEnvelope // first is for all new blobs, the following for moved/deduplicated ones
	Changesets        []CollectionChangeset
	Metadata          map[string]string
	Rating            int // 1-5
	Tags              []string
	GlobalVersion     uint64 `msgpack:"gv"`

func (*Collection) BumpGlobalVersion

func (c *Collection) BumpGlobalVersion()

this implementation is really bad as a global ordering number (time synchronization issues between servers, time jumping back and forth..), but this is temporary until we're migrating to EventHorizon which gives us change feeds in a much better way.

type CollectionChangeset

type CollectionChangeset struct {
	ID           string
	Parent       string
	Created      time.Time
	FilesCreated []File
	FilesUpdated []File
	FilesDeleted []string

func NewChangeset

func NewChangeset(
	id string,
	parent string,
	created time.Time,
	filesCreated []File,
	filesUpdated []File,
	filesDeleted []string,
) CollectionChangeset

func (*CollectionChangeset) AnyChanges

func (c *CollectionChangeset) AnyChanges() bool

type Config

type Config struct {
	Key   string
	Value string

type Directory

type Directory struct {
	ID                string
	Created           time.Time
	MetaCollection    string // backing collection for directory's metadata
	Parent            string
	Name              string
	Type              string
	Sensitivity       int               // 0(for all eyes) 1(a bit sensitive) 2(for my eyes only)
	ReplicationPolicy string            // explicit (for collections it is calculated)
	Deprecated1       map[string]string `msgpack:"Metadata" json:"Metadata"`
	Deprecated2       string            `msgpack:"Description" json:"Description"`

func NewDirectory

func NewDirectory(id string, parent string, name string, typ string) *Directory

type File

type File struct {
	Path     string
	Sha256   string
	Created  time.Time
	Modified time.Time
	Size     int64
	BlobRefs []string // TODO: use explicit datatype?

func (*File) CopyEverythingExceptPath

func (f *File) CopyEverythingExceptPath(other File)

type IntegrityVerificationJob

type IntegrityVerificationJob struct {
	ID                   string
	Started              time.Time
	Completed            time.Time
	VolumeId             int
	LastCompletedBlobRef BlobRef
	BytesScanned         uint64
	ErrorsFound          int
	Report               string

type KeyEncryptionKey

type KeyEncryptionKey struct {
	ID          string
	Kind        string // rsa | ecdsa
	Bits        int
	Created     time.Time
	Label       string
	Fingerprint string // for public key
	PublicKey   string
	PrivateKey  string

type KeyEnvelope

type KeyEnvelope struct {
	KeyId string    `json:"key_id"`
	Slots []KeySlot `json:"slots"`

func FindDekEnvelope

func FindDekEnvelope(keyId string, kenvs []KeyEnvelope) *KeyEnvelope

type KeySlot

type KeySlot struct {
	KekFingerprint string `json:"kek_fingerprint"`
	KeyEncrypted   []byte `json:"key_encrypted"`

type Node

type Node struct {
	ID           string
	Addr         string
	Name         string
	TlsCert      string
	SmartBackend stoservertypes.SmartBackend

type ReplicationPolicy

type ReplicationPolicy struct {
	ID             string
	Name           string
	DesiredVolumes []int // where the policy currently directs data (TODO: rename to CurrentVolumes?)
	MinZones       int   // if >= 2, then data is considered fire etc. disaster safe

func (*ReplicationPolicy) ReplicaCount

func (r *ReplicationPolicy) ReplicaCount() int

type ScheduledJob

type ScheduledJob struct {
	ID          string
	Kind        stoservertypes.ScheduledJobKind
	Description string
	Schedule    string
	Enabled     bool
	NextRun     time.Time
	LastRun     *ScheduledJobLastRun

type ScheduledJobLastRun

type ScheduledJobLastRun struct {
	Started  time.Time
	Finished time.Time
	Error    string

func (ScheduledJobLastRun) Runtime

func (s ScheduledJobLastRun) Runtime() time.Duration

type Volume

type Volume struct {
	ID                 int
	UUID               string
	Label              string
	Description        string
	Notes              string
	SerialNumber       string
	Technology         string
	SmartId            string
	SmartReport        string
	Zone               string
	Enclosure          string
	EnclosureSlot      int // 0 = not defined
	Manufactured       time.Time
	WarrantyEnds       time.Time
	Quota              int64
	BlobSizeTotal      int64 // @ compressed & deduplicated
	BlobCount          int64 // does not include queued writes or volume descriptor blob (sha256=0000..)
	Decommissioned     *time.Time
	DecommissionReason string

type VolumeMount

type VolumeMount struct {
	ID         string
	Volume     int
	Node       string
	Driver     stoservertypes.VolumeDriverKind
	DriverOpts string

Jump to

Keyboard shortcuts

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