varasto: Index | Files

package stotypes

import ""


Package Files

apptypes.go dbtypes.go errors.go getters.go


const (
    BlobSize = 4 * mebibyte

    NoParentId = ""


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

type Blob Uses

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 Uses

type BlobRef []byte

func BlobRefFromBytes Uses

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

func BlobRefFromHex Uses

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

func (*BlobRef) AsHex Uses

func (b *BlobRef) AsHex() string

func (*BlobRef) AsSha256Sum Uses

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

func (*BlobRef) Equal Uses

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

type Client Uses

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

type Collection Uses

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 Uses

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 Uses

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

func NewChangeset Uses

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

func (*CollectionChangeset) AnyChanges Uses

func (c *CollectionChangeset) AnyChanges() bool

type Config Uses

type Config struct {
    Key   string
    Value string

type Directory Uses

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 Uses

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

type File Uses

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

func (*File) CopyEverythingExceptPath Uses

func (f *File) CopyEverythingExceptPath(other File)

type IntegrityVerificationJob Uses

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

type KeyEncryptionKey Uses

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 Uses

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

func FindDekEnvelope Uses

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

type KeySlot Uses

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

type Node Uses

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

type ReplicationPolicy Uses

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 Uses

func (r *ReplicationPolicy) ReplicaCount() int

type ScheduledJob Uses

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

type ScheduledJobLastRun Uses

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

func (ScheduledJobLastRun) Runtime Uses

func (s ScheduledJobLastRun) Runtime() time.Duration

type Volume Uses

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 Uses

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

Package stotypes imports 6 packages (graph) and is imported by 17 packages. Updated 2020-09-27. Refresh now. Tools for package owners.