refs

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ErrWrongAddress is raised when wrong address is passed to Address.Parse ParseAddress.
	ErrWrongAddress = internal.Error("wrong address")

	// ErrEmptyAddress is raised when empty address is passed to Address.Parse ParseAddress.
	ErrEmptyAddress = internal.Error("empty address")
)
View Source
const (
	// UUIDSize contains size of UUID.
	UUIDSize = 16

	// SGIDSize contains size of SGID.
	SGIDSize = UUIDSize

	// CIDSize contains size of CID.
	CIDSize = sha256.Size

	// OwnerIDSize contains size of OwnerID.
	OwnerIDSize = chain.AddressLength

	// ErrWrongDataSize is raised when passed bytes into Unmarshal have wrong size.
	ErrWrongDataSize = internal.Error("wrong data size")

	// ErrEmptyOwner is raised when empty OwnerID is passed into container.New.
	ErrEmptyOwner = internal.Error("owner cant be empty")

	// ErrEmptyCapacity is raised when empty Capacity is passed container.New.
	ErrEmptyCapacity = internal.Error("capacity cant be empty")

	// ErrEmptyContainer is raised when it CID method is called for an empty container.
	ErrEmptyContainer = internal.Error("cannot return ID for empty container")
)

Variables

View Source
var (

	// NewSGID method alias.
	NewSGID = NewUUID

	// NewObjectID method alias.
	NewObjectID = NewUUID

	// NewMessageID method alias.
	NewMessageID = NewUUID
)
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")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	// ObjectID is an object identifier, valid UUIDv4 represented in bytes
	ObjectID ObjectID `protobuf:"bytes,1,opt,name=ObjectID,proto3,customtype=ObjectID" json:"ObjectID"`
	// CID is container identifier
	CID                  CID      `protobuf:"bytes,2,opt,name=CID,proto3,customtype=CID" json:"CID"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Address of object (container id + object id)

func ParseAddress

func ParseAddress(str string) (*Address, error)

ParseAddress parses address from string representation into new Address.

func (*Address) Descriptor

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

func (Address) Equal

func (m Address) Equal(a2 *Address) bool

Equal checks that current Address is equal to passed Address.

func (Address) Hash

func (m Address) Hash() ([]byte, error)

Hash returns []byte that used as a key for storage bucket.

func (Address) IsFull

func (m Address) IsFull() bool

IsFull checks that ContainerID and ObjectID is not empty.

func (*Address) Marshal

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

func (*Address) MarshalTo

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

func (*Address) MarshalToSizedBuffer

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

func (*Address) Parse

func (m *Address) Parse(addr string) error

Parse parses address from string representation into current Address.

func (*Address) ProtoMessage

func (*Address) ProtoMessage()

func (*Address) Reset

func (m *Address) Reset()

func (*Address) Size

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

func (Address) String

func (m Address) String() string

String returns string representation of Address.

func (*Address) Unmarshal

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

func (*Address) XXX_DiscardUnknown

func (m *Address) XXX_DiscardUnknown()

func (*Address) XXX_Marshal

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

func (*Address) XXX_Merge

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

func (*Address) XXX_Size

func (m *Address) XXX_Size() int

func (*Address) XXX_Unmarshal

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

type CID

type CID [CIDSize]byte

CID is implementation of ContainerID.

func CIDForBytes

func CIDForBytes(data []byte) CID

CIDForBytes creates CID for passed bytes.

func CIDFromBytes

func CIDFromBytes(data []byte) (cid CID, err error)

CIDFromBytes parses CID from passed bytes.

func CIDFromString

func CIDFromString(c string) (CID, error)

CIDFromString parses CID from string representation of CID.

func (CID) Bytes

func (c CID) Bytes() []byte

Bytes returns CID bytes representation.

func (CID) Empty

func (c CID) Empty() bool

Empty checks that current CID is empty.

func (CID) Equal

func (c CID) Equal(cid CID) bool

Equal checks that current CID is equal to passed CID.

func (CID) Marshal

func (c CID) Marshal() ([]byte, error)

Marshal returns CID bytes representation.

func (CID) MarshalBinary

func (c CID) MarshalBinary() ([]byte, error)

MarshalBinary returns CID bytes representation.

func (*CID) MarshalTo

func (c *CID) MarshalTo(data []byte) (int, error)

MarshalTo marshal CID to bytes representation into passed bytes.

func (*CID) Parse

func (c *CID) Parse(cid string) error

Parse tries to parse CID from string representation.

func (CID) ProtoMessage

func (c CID) ProtoMessage()

ProtoMessage method to satisfy proto.Message interface.

func (*CID) Reset

func (c *CID) Reset()

Reset resets current CID to zero value.

func (CID) Size

func (c CID) Size() int

Size returns size of CID (CIDSize).

func (CID) String

func (c CID) String() string

String returns string representation of CID.

func (*CID) Unmarshal

func (c *CID) Unmarshal(data []byte) error

Unmarshal tries to parse bytes representation of CID.

func (*CID) UnmarshalBinary

func (c *CID) UnmarshalBinary(data []byte) error

UnmarshalBinary tries to parse bytes representation of CID.

func (CID) Verify

func (c CID) Verify(data []byte) error

Verify validates that current CID is generated for passed bytes data.

type MessageID

type MessageID = UUID

MessageID is type alias of UUID.

type ObjectID

type ObjectID = UUID

ObjectID is type alias of UUID.

type OwnerID

type OwnerID chain.WalletAddress

OwnerID is wrapper over neofs-proto/chain.WalletAddress.

func NewOwnerID

func NewOwnerID(keys ...*ecdsa.PublicKey) (owner OwnerID, err error)

NewOwnerID returns generated OwnerID from passed public keys.

func (OwnerID) Bytes

func (o OwnerID) Bytes() []byte

Bytes returns OwnerID bytes representation.

func (OwnerID) Empty

func (o OwnerID) Empty() bool

Empty checks that current OwnerID is empty value.

func (OwnerID) Equal

func (o OwnerID) Equal(id OwnerID) bool

Equal checks that current OwnerID is equal to passed OwnerID.

func (OwnerID) Marshal

func (o OwnerID) Marshal() ([]byte, error)

Marshal returns OwnerID bytes representation.

func (OwnerID) MarshalTo

func (o OwnerID) MarshalTo(data []byte) (int, error)

MarshalTo copies OwnerID bytes representation into passed slice of bytes.

func (OwnerID) ProtoMessage

func (OwnerID) ProtoMessage()

ProtoMessage method to satisfy proto.Message interface.

func (*OwnerID) Reset

func (o *OwnerID) Reset()

Reset sets current OwnerID to empty value.

func (OwnerID) Size

func (OwnerID) Size() int

Size returns OwnerID size in bytes (OwnerIDSize).

func (OwnerID) String

func (o OwnerID) String() string

String returns string representation of OwnerID.

func (*OwnerID) Unmarshal

func (o *OwnerID) Unmarshal(data []byte) error

Unmarshal tries to parse OwnerID bytes representation into current OwnerID.

type SGID

type SGID = UUID

SGID is type alias of UUID.

func SGIDFromBytes

func SGIDFromBytes(data []byte) (sgid SGID, err error)

SGIDFromBytes parse bytes representation of SGID into new SGID value.

type UUID

type UUID uuid.UUID

UUID wrapper over github.com/google/uuid.UUID.

func NewUUID

func NewUUID() (UUID, error)

NewUUID returns a Random (Version 4) UUID.

The strength of the UUIDs is based on the strength of the crypto/rand package.

A note about uniqueness derived from the UUID Wikipedia entry:

Randomly generated UUIDs have 122 random bits.  One's annual risk of being
hit by a meteorite is estimated to be one chance in 17 billion, that
means the probability is about 0.00000000006 (6 × 10−11),
equivalent to the odds of creating a few tens of trillions of UUIDs in a
year and having one duplicate.

func (UUID) Bytes

func (u UUID) Bytes() []byte

Bytes returns UUID bytes representation.

func (UUID) Empty

func (u UUID) Empty() bool

Empty checks that current UUID is empty value.

func (UUID) Equal

func (u UUID) Equal(u2 UUID) bool

Equal checks that current UUID is equal to passed UUID.

func (UUID) Marshal

func (u UUID) Marshal() ([]byte, error)

Marshal returns UUID bytes representation.

func (UUID) MarshalTo

func (u UUID) MarshalTo(data []byte) (int, error)

MarshalTo returns UUID bytes representation.

func (*UUID) Parse

func (u *UUID) Parse(id string) error

Parse tries to parse UUID string representation.

func (UUID) ProtoMessage

func (UUID) ProtoMessage()

ProtoMessage method to satisfy proto.Message.

func (*UUID) Reset

func (u *UUID) Reset()

Reset sets current UUID to empty value.

func (UUID) Size

func (UUID) Size() int

Size returns size in bytes of UUID (UUIDSize).

func (UUID) String

func (u UUID) String() string

func (*UUID) Unmarshal

func (u *UUID) Unmarshal(data []byte) error

Unmarshal tries to parse UUID bytes representation.

Jump to

Keyboard shortcuts

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