storagegroup

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var StorageGroup_Lifetime_Unit_name = map[int32]string{
	0: "Unlimited",
	1: "NeoFSEpoch",
	2: "UnixTime",
}
View Source
var StorageGroup_Lifetime_Unit_value = map[string]int32{
	"Unlimited":  0,
	"NeoFSEpoch": 1,
	"UnixTime":   2,
}

Functions

func CalculateHash

func CalculateHash(sg Provider) (hash.Hash, error)

CalculateHash returns homomorphic sum of hashes fromm all zones in storage group.

func CalculateSize

func CalculateSize(sg Provider) (size uint64)

CalculateSize combines length of all zones in storage group.

Types

type Hash

type Hash = hash.Hash

Hash is alias of hash.Hash for proto definition.

type IDList

type IDList []refs.ObjectID

IDList is a slice of object ids, that can be sorted.

func (IDList) Len

func (s IDList) Len() int

Len returns amount of object ids in IDList.

func (IDList) Less

func (s IDList) Less(i, j int) bool

Less returns byte comparision between IDList[i] and IDList[j].

func (IDList) Swap

func (s IDList) Swap(i, j int)

Swap swaps element with i and j index in IDList.

type IdentificationInfo

type IdentificationInfo struct {
	CID     refs.CID
	SGID    refs.SGID
	OwnerID refs.OwnerID
}

IdentificationInfo provides meta information about storage group.

type InfoReceiver

type InfoReceiver interface {
	GetSGInfo(ctx context.Context, cid refs.CID, group []refs.ObjectID) (*StorageGroup, error)
}

InfoReceiver defines GetSGInfo function that returns storage group that contains passed object ids.

type Lister

type Lister interface {
	List(ctx context.Context, cid refs.CID) ([]refs.SGID, error)
}

Lister defines list function that returns all storage groups created for the passed container

type Provider

type Provider interface {
	// Group returns list of object ids of the storage group.
	// This list **should be** sorted.
	Group() []refs.ObjectID

	IDInfo() *IdentificationInfo
	Zones() []ZoneInfo
}

Provider is an interface that defines storage group instance. There was different storage group implementation. Right now it is implemented as extended header in the object.

type Receiver

type Receiver interface {
	Get(ctx context.Context, cid refs.CID, sgid refs.SGID) (Provider, error)
}

Receiver defines get function that returns asked storage group

type Receptacle

type Receptacle interface {
	Put(ctx context.Context, sg Provider) error
}

Receptacle defines put function that places storage group in the store.

type StorageGroup

type StorageGroup struct {
	// ValidationDataSize is size of the all object's payloads included into storage group
	ValidationDataSize uint64 `protobuf:"varint,1,opt,name=ValidationDataSize,proto3" json:"ValidationDataSize,omitempty"`
	// ValidationHash is homomorphic hash of all object's payloads included into storage group
	ValidationHash Hash `protobuf:"bytes,2,opt,name=ValidationHash,proto3,customtype=Hash" json:"ValidationHash"`
	// Lifetime is time until storage group is valid
	Lifetime             *StorageGroup_Lifetime `protobuf:"bytes,3,opt,name=lifetime,proto3" json:"lifetime,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*StorageGroup) Descriptor

func (*StorageGroup) Descriptor() ([]byte, []int)

func (StorageGroup) Empty

func (m StorageGroup) Empty() bool

Empty checks if storage group has some data for validation.

func (*StorageGroup) GetLifetime

func (m *StorageGroup) GetLifetime() *StorageGroup_Lifetime

func (*StorageGroup) GetValidationDataSize

func (m *StorageGroup) GetValidationDataSize() uint64

func (*StorageGroup) Marshal

func (m *StorageGroup) Marshal() (dAtA []byte, err error)

func (*StorageGroup) MarshalTo

func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error)

func (*StorageGroup) MarshalToSizedBuffer

func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StorageGroup) ProtoMessage

func (*StorageGroup) ProtoMessage()

func (*StorageGroup) Reset

func (m *StorageGroup) Reset()

func (*StorageGroup) Size

func (m *StorageGroup) Size() (n int)

func (*StorageGroup) String

func (m *StorageGroup) String() string

String returns string representation of StorageGroup.

func (*StorageGroup) Unmarshal

func (m *StorageGroup) Unmarshal(dAtA []byte) error

func (*StorageGroup) XXX_DiscardUnknown

func (m *StorageGroup) XXX_DiscardUnknown()

func (*StorageGroup) XXX_Marshal

func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StorageGroup) XXX_Merge

func (m *StorageGroup) XXX_Merge(src proto.Message)

func (*StorageGroup) XXX_Size

func (m *StorageGroup) XXX_Size() int

func (*StorageGroup) XXX_Unmarshal

func (m *StorageGroup) XXX_Unmarshal(b []byte) error

type StorageGroup_Lifetime

type StorageGroup_Lifetime struct {
	// Unit is lifetime type
	Unit StorageGroup_Lifetime_Unit `protobuf:"varint,1,opt,name=unit,proto3,enum=storagegroup.StorageGroup_Lifetime_Unit" json:"unit,omitempty"`
	// Value for lifetime
	Value                int64    `protobuf:"varint,2,opt,name=Value,proto3" json:"Value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StorageGroup_Lifetime) Descriptor

func (*StorageGroup_Lifetime) Descriptor() ([]byte, []int)

func (*StorageGroup_Lifetime) GetUnit

func (*StorageGroup_Lifetime) GetValue

func (m *StorageGroup_Lifetime) GetValue() int64

func (*StorageGroup_Lifetime) Marshal

func (m *StorageGroup_Lifetime) Marshal() (dAtA []byte, err error)

func (*StorageGroup_Lifetime) MarshalTo

func (m *StorageGroup_Lifetime) MarshalTo(dAtA []byte) (int, error)

func (*StorageGroup_Lifetime) MarshalToSizedBuffer

func (m *StorageGroup_Lifetime) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StorageGroup_Lifetime) ProtoMessage

func (*StorageGroup_Lifetime) ProtoMessage()

func (*StorageGroup_Lifetime) Reset

func (m *StorageGroup_Lifetime) Reset()

func (*StorageGroup_Lifetime) Size

func (m *StorageGroup_Lifetime) Size() (n int)

func (*StorageGroup_Lifetime) String

func (m *StorageGroup_Lifetime) String() string

func (*StorageGroup_Lifetime) Unmarshal

func (m *StorageGroup_Lifetime) Unmarshal(dAtA []byte) error

func (*StorageGroup_Lifetime) XXX_DiscardUnknown

func (m *StorageGroup_Lifetime) XXX_DiscardUnknown()

func (*StorageGroup_Lifetime) XXX_Marshal

func (m *StorageGroup_Lifetime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StorageGroup_Lifetime) XXX_Merge

func (m *StorageGroup_Lifetime) XXX_Merge(src proto.Message)

func (*StorageGroup_Lifetime) XXX_Size

func (m *StorageGroup_Lifetime) XXX_Size() int

func (*StorageGroup_Lifetime) XXX_Unmarshal

func (m *StorageGroup_Lifetime) XXX_Unmarshal(b []byte) error

type StorageGroup_Lifetime_Unit

type StorageGroup_Lifetime_Unit int32
const (
	// Unlimited set if storage group always valid
	StorageGroup_Lifetime_Unlimited StorageGroup_Lifetime_Unit = 0
	// NeoFSEpoch set if storage group is valid until lifetime NeoFS epoch
	StorageGroup_Lifetime_NeoFSEpoch StorageGroup_Lifetime_Unit = 1
	// UnixTime set if storage group is valid until lifetime unix timestamp
	StorageGroup_Lifetime_UnixTime StorageGroup_Lifetime_Unit = 2
)

func (StorageGroup_Lifetime_Unit) EnumDescriptor

func (StorageGroup_Lifetime_Unit) EnumDescriptor() ([]byte, []int)

func (StorageGroup_Lifetime_Unit) String

type Store

type Store interface {
	Lister
	Receiver
	Receptacle
}

Store is a interface for storing users storage group

type ZoneInfo

type ZoneInfo struct {
	hash.Hash
	Size uint64
}

ZoneInfo provides validation information of storage group.

Jump to

Keyboard shortcuts

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