Documentation ¶
Overview ¶
Package storj contains the types which represent the main entities of the Storj domain.
Index ¶
- Constants
- Variables
- func IDVersionInVersions(versionNumber IDVersionNumber, versionsStr string) error
- func NewPieceKey() (PiecePublicKey, PiecePrivateKey, error)
- func NewVersionExt(version IDVersion) pkix.Extension
- func SplitPath(path Path) []string
- type Bucket
- type BucketList
- type BucketListOptions
- type CipherSuite
- type CreateObject
- type EncryptedPrivateKey
- type EncryptionParameters
- type IDVersion
- type IDVersionNumber
- type Key
- type LastSegment
- type ListDirection
- type ListOptions
- type Metainfo
- type MetainfoLimits
- type MutableObject
- type MutableStream
- type NodeID
- func (id NodeID) Bytes() []byte
- func (id NodeID) Difficulty() (uint16, error)
- func (id NodeID) IsZero() bool
- func (id NodeID) Less(b NodeID) bool
- func (id NodeID) Marshal() ([]byte, error)
- func (id NodeID) MarshalJSON() ([]byte, error)
- func (id *NodeID) MarshalTo(data []byte) (n int, err error)
- func (id *NodeID) Scan(src interface{}) (err error)
- func (id *NodeID) Size() int
- func (id NodeID) String() string
- func (id *NodeID) Unmarshal(data []byte) error
- func (id *NodeID) UnmarshalJSON(data []byte) error
- func (id NodeID) Value() (driver.Value, error)
- func (id NodeID) Version() IDVersion
- type NodeIDList
- type NodeURL
- type NodeURLs
- type Nonce
- type Object
- type ObjectList
- type Path
- type Piece
- type PieceID
- func (id PieceID) Bytes() []byte
- func (id PieceID) Derive(storagenodeID NodeID, pieceNum int32) PieceID
- func (id PieceID) IsZero() bool
- func (id PieceID) Marshal() ([]byte, error)
- func (id PieceID) MarshalJSON() ([]byte, error)
- func (id *PieceID) MarshalTo(data []byte) (n int, err error)
- func (id *PieceID) Scan(src interface{}) (err error)
- func (id *PieceID) Size() int
- func (id PieceID) String() string
- func (id *PieceID) Unmarshal(data []byte) error
- func (id *PieceID) UnmarshalJSON(data []byte) error
- func (id PieceID) Value() (driver.Value, error)
- type PiecePrivateKey
- func (key PiecePrivateKey) Bytes() []byte
- func (key PiecePrivateKey) IsZero() bool
- func (key PiecePrivateKey) Marshal() ([]byte, error)
- func (key *PiecePrivateKey) MarshalTo(data []byte) (n int, err error)
- func (key *PiecePrivateKey) Scan(src interface{}) (err error)
- func (key PiecePrivateKey) Sign(data []byte) ([]byte, error)
- func (key *PiecePrivateKey) Size() int
- func (key *PiecePrivateKey) Unmarshal(data []byte) error
- func (key PiecePrivateKey) Value() (driver.Value, error)
- type PiecePublicKey
- func (key PiecePublicKey) Bytes() []byte
- func (key PiecePublicKey) IsZero() bool
- func (key PiecePublicKey) Marshal() ([]byte, error)
- func (key *PiecePublicKey) MarshalTo(data []byte) (n int, err error)
- func (key *PiecePublicKey) Scan(src interface{}) (err error)
- func (key *PiecePublicKey) Size() int
- func (key *PiecePublicKey) Unmarshal(data []byte) error
- func (key PiecePublicKey) Value() (driver.Value, error)
- func (key PiecePublicKey) Verify(data, signature []byte) error
- type ReadOnlyStream
- type RedundancyAlgorithm
- type RedundancyScheme
- type Segment
- type SerialNumber
- func (id SerialNumber) Bytes() []byte
- func (id SerialNumber) IsZero() bool
- func (id SerialNumber) Marshal() ([]byte, error)
- func (id SerialNumber) MarshalJSON() ([]byte, error)
- func (id *SerialNumber) MarshalTo(data []byte) (n int, err error)
- func (id *SerialNumber) Scan(src interface{}) (err error)
- func (id *SerialNumber) Size() int
- func (id SerialNumber) String() string
- func (id *SerialNumber) Unmarshal(data []byte) error
- func (id *SerialNumber) UnmarshalJSON(data []byte) error
- func (id SerialNumber) Value() (driver.Value, error)
- type Stream
- type StreamID
- func (id StreamID) Bytes() []byte
- func (id StreamID) IsZero() bool
- func (id StreamID) Marshal() ([]byte, error)
- func (id StreamID) MarshalJSON() ([]byte, error)
- func (id *StreamID) MarshalTo(data []byte) (n int, err error)
- func (id *StreamID) Scan(src interface{}) (err error)
- func (id *StreamID) Size() int
- func (id StreamID) String() string
- func (id *StreamID) Unmarshal(data []byte) error
- func (id *StreamID) UnmarshalJSON(data []byte) error
- func (id StreamID) Value() (driver.Value, error)
Constants ¶
const ( // EncUnspecified indicates no encryption suite has been selected. EncUnspecified = CipherSuite(iota) // EncNull indicates use of the NULL cipher; that is, no encryption is // done. The ciphertext is equal to the plaintext. EncNull // EncAESGCM indicates use of AES128-GCM encryption. EncAESGCM // EncSecretBox indicates use of XSalsa20-Poly1305 encryption, as provided // by the NaCl cryptography library under the name "Secretbox". EncSecretBox )
const ( KeySize = 32 NonceSize = 24 )
Constant definitions for key and nonce sizes
const ( // Before lists backwards from cursor, without cursor Before = ListDirection(-2) // Backward lists backwards from cursor, including cursor Backward = ListDirection(-1) // Forward lists forwards from cursor, including cursor Forward = ListDirection(1) // After lists forwards from cursor, without cursor After = ListDirection(2) )
const ( InvalidRedundancyAlgorithm = RedundancyAlgorithm(iota) ReedSolomon )
List of supported redundancy algorithms
const NodeIDSize = sha256.Size
NodeIDSize is the byte length of a NodeID
const ( // V0 represents identity version 0 // NB: identities created before identity versioning (i.e. which don't have a // version extension; "legacy") will be recognized as V0. V0 = IDVersionNumber(iota) )
Variables ¶
var ( // ErrBucket is an error class for general bucket errors ErrBucket = errs.Class("bucket") // ErrNoBucket is an error class for using empty bucket name ErrNoBucket = errs.Class("no bucket specified") // ErrBucketNotFound is an error class for non-existing bucket ErrBucketNotFound = errs.Class("bucket not found") )
var ( // IDVersions is a map of all identity versions IDVersions = map[IDVersionNumber]IDVersion{ V0: { Number: V0, NewPrivateKey: pkcrypto.GeneratePrivateKey, }, } // IDVersionHandler compares the identity version of the remote peers // certificate chain to the extension options passed to the factory. IDVersionHandler = extensions.NewHandlerFactory( &extensions.IdentityVersionExtID, idVersionHandler, ) )
var ( // ErrNodeID is used when something goes wrong with a node id. ErrNodeID = errs.Class("node ID error") // ErrVersion is used for identity version related errors. ErrVersion = errs.Class("node ID version error") )
var ( // ErrNoPath is an error class for using empty path ErrNoPath = errs.Class("no path specified") // ErrObjectNotFound is an error class for non-existing object ErrObjectNotFound = errs.Class("object not found") )
var ( // ErrNodeURL is used when something goes wrong with a node url. ErrNodeURL = errs.Class("node URL error") )
var ErrPieceID = errs.Class("piece ID error")
ErrPieceID is used when something goes wrong with a piece ID
var ErrPieceKey = errs.Class("piece key error")
ErrPieceKey is used when something goes wrong with a piece key
var ErrSerialNumber = errs.Class("serial number error")
ErrSerialNumber is used when something goes wrong with a serial number
var ErrStreamID = errs.Class("stream ID error")
ErrStreamID is used when something goes wrong with a stream ID
Functions ¶
func IDVersionInVersions ¶ added in v0.9.0
func IDVersionInVersions(versionNumber IDVersionNumber, versionsStr string) error
IDVersionInVersions returns an error if the given version is in the given string of version(s)/range(s).
func NewPieceKey ¶ added in v0.15.0
func NewPieceKey() (PiecePublicKey, PiecePrivateKey, error)
NewPieceKey creates a piece key pair
func NewVersionExt ¶ added in v0.9.0
NewVersionExt creates a new identity version certificate extension for the given identity version,
Types ¶
type Bucket ¶
type Bucket struct { ID uuid.UUID Name string ProjectID uuid.UUID PartnerID uuid.UUID Created time.Time PathCipher CipherSuite DefaultSegmentsSize int64 DefaultRedundancyScheme RedundancyScheme DefaultEncryptionParameters EncryptionParameters }
Bucket contains information about a specific bucket
type BucketList ¶
BucketList is a list of buckets
type BucketListOptions ¶
type BucketListOptions struct { Cursor string Direction ListDirection Limit int }
BucketListOptions lists objects
func (BucketListOptions) NextPage ¶
func (opts BucketListOptions) NextPage(list BucketList) BucketListOptions
NextPage returns options for listing the next page
type CipherSuite ¶
type CipherSuite byte
CipherSuite specifies one of the encryption suites supported by Storj libraries for encryption of in-network data.
type CreateObject ¶
type CreateObject struct { Metadata map[string]string ContentType string Expires time.Time RedundancyScheme EncryptionParameters }
CreateObject has optional parameters that can be set
type EncryptedPrivateKey ¶
type EncryptedPrivateKey []byte
EncryptedPrivateKey is a private key that has been encrypted
type EncryptionParameters ¶
type EncryptionParameters struct { // CipherSuite specifies the cipher suite to be used for encryption. CipherSuite CipherSuite // BlockSize determines the unit size at which encryption is performed. // It is important to distinguish this from the block size used by the // cipher suite (probably 128 bits). There is some small overhead for // each encryption unit, so BlockSize should not be too small, but // smaller sizes yield shorter first-byte latency and better seek times. // Note that BlockSize itself is the size of data blocks _after_ they // have been encrypted and the authentication overhead has been added. // It is _not_ the size of the data blocks to _be_ encrypted. BlockSize int32 }
EncryptionParameters is the cipher suite and parameters used for encryption
func (EncryptionParameters) IsZero ¶
func (params EncryptionParameters) IsZero() bool
IsZero returns true if no field in the struct is set to non-zero value
type IDVersion ¶
type IDVersion struct { Number IDVersionNumber NewPrivateKey func() (crypto.PrivateKey, error) }
IDVersion holds fields that are used to distinguish different identity versions from one another; used in identity generation.
func GetIDVersion ¶ added in v0.9.0
func GetIDVersion(number IDVersionNumber) (IDVersion, error)
GetIDVersion looks up the given version number in the map of registered versions, returning an error if none is found.
func IDVersionFromCert ¶ added in v0.9.0
func IDVersionFromCert(cert *x509.Certificate) (IDVersion, error)
IDVersionFromCert parsed the IDVersion from the passed certificate's IDVersion extension.
func LatestIDVersion ¶ added in v0.9.0
func LatestIDVersion() IDVersion
LatestIDVersion returns the last IDVersion registered.
type IDVersionNumber ¶ added in v0.9.0
type IDVersionNumber uint8
IDVersionNumber is the number of an identity version.
type Key ¶
Key represents the largest key used by any encryption protocol
type LastSegment ¶
type LastSegment struct { Size int64 EncryptedKeyNonce Nonce EncryptedKey EncryptedPrivateKey }
LastSegment contains info about last segment TODO: remove
type ListOptions ¶
type ListOptions struct { Prefix Path Cursor Path // Cursor is relative to Prefix, full path is Prefix + Cursor Delimiter rune Recursive bool Direction ListDirection Limit int }
ListOptions lists objects
func (ListOptions) NextPage ¶
func (opts ListOptions) NextPage(list ObjectList) ListOptions
NextPage returns options for listing the next page
type Metainfo ¶
type Metainfo interface { // Limits returns limits for this metainfo database Limits() (MetainfoLimits, error) // CreateBucket creates a new bucket with the specified information // Database automatically sets different values in the information CreateBucket(ctx context.Context, bucket string, info *Bucket) (Bucket, error) // DeleteBucket deletes bucket DeleteBucket(ctx context.Context, bucket string) error // GetBucket gets bucket information GetBucket(ctx context.Context, bucket string) (Bucket, error) // ListBuckets lists buckets starting from first ListBuckets(ctx context.Context, options BucketListOptions) (BucketList, error) // GetObject returns information about an object GetObject(ctx context.Context, bucket string, path Path) (Object, error) // GetObjectStream returns interface for reading the object stream GetObjectStream(ctx context.Context, bucket string, path Path) (ReadOnlyStream, error) // CreateObject creates a mutable object for uploading stream info CreateObject(ctx context.Context, bucket string, path Path, info *CreateObject) (MutableObject, error) // ModifyObject creates a mutable object for updating a partially uploaded object ModifyObject(ctx context.Context, bucket string, path Path) (MutableObject, error) // DeleteObject deletes an object from database DeleteObject(ctx context.Context, bucket string, path Path) error // ListObjects lists objects in bucket based on the ListOptions ListObjects(ctx context.Context, bucket string, options ListOptions) (ObjectList, error) // ModifyPendingObject creates a mutable object for updating a partially uploaded object ModifyPendingObject(ctx context.Context, bucket string, path Path) (MutableObject, error) // ListPendingObjects lists pending objects in bucket based on the ListOptions ListPendingObjects(ctx context.Context, bucket string, options ListOptions) (ObjectList, error) }
Metainfo represents a database for storing meta-info about objects
type MetainfoLimits ¶
type MetainfoLimits struct { // ListLimit specifies the maximum amount of items that can be listed at a time. ListLimit int64 // MinimumRemoteSegmentSize specifies the minimum remote segment that is allowed to be stored. MinimumRemoteSegmentSize int64 // MaximumInlineSegmentSize specifies the maximum inline segment that is allowed to be stored. MaximumInlineSegmentSize int64 }
MetainfoLimits lists limits specified for the Metainfo database
type MutableObject ¶
type MutableObject interface { // Info gets the current information about the object Info() Object // CreateStream creates a new stream for the object CreateStream(ctx context.Context) (MutableStream, error) // ContinueStream starts to continue a partially uploaded stream. ContinueStream(ctx context.Context) (MutableStream, error) // DeleteStream deletes any information about this objects stream DeleteStream(ctx context.Context) error // Commit commits the changes to the database Commit(ctx context.Context) error }
MutableObject is an interface for manipulating creating/deleting object stream
type MutableStream ¶
type MutableStream interface { Info() Object // AddSegments adds segments to the stream. AddSegments(ctx context.Context, segments ...Segment) error // UpdateSegments updates information about segments. UpdateSegments(ctx context.Context, segments ...Segment) error }
MutableStream is an interface for manipulating stream information
type NodeID ¶
type NodeID [NodeIDSize]byte
NodeID is a unique node identifier
func NewVersionedID ¶ added in v0.9.0
NewVersionedID adds an identity version to a node ID.
func NodeIDFromBytes ¶
NodeIDFromBytes converts a byte slice into a node id
func NodeIDFromString ¶
NodeIDFromString decodes a base58check encoded node id string
func (NodeID) Difficulty ¶
Difficulty returns the number of trailing zero bits in a node ID
func (NodeID) MarshalJSON ¶
MarshalJSON serializes a node ID to a json string as bytes
func (*NodeID) Size ¶
Size returns the length of a node ID (implements gogo's custom type interface)
func (NodeID) String ¶
String returns NodeID as base58 encoded string with checksum and version bytes
func (*NodeID) UnmarshalJSON ¶
UnmarshalJSON deserializes a json string (as bytes) to a node ID
type NodeIDList ¶
type NodeIDList []NodeID
NodeIDList is a slice of NodeIDs (implements sort)
func NodeIDsFromBytes ¶
func NodeIDsFromBytes(b [][]byte) (ids NodeIDList, err error)
NodeIDsFromBytes converts a 2d byte slice into a list of nodes
func (NodeIDList) Bytes ¶
func (n NodeIDList) Bytes() (idsBytes [][]byte)
Bytes returns a 2d byte slice of the node IDs
func (NodeIDList) Less ¶
func (n NodeIDList) Less(i, j int) bool
Less implements sort.Interface.Less()
func (NodeIDList) Strings ¶ added in v0.13.0
func (n NodeIDList) Strings() []string
Strings returns a string slice of the node IDs
type NodeURL ¶ added in v0.15.0
NodeURL defines a structure for connecting to a node.
func ParseNodeURL ¶ added in v0.15.0
ParseNodeURL parses node URL string.
Examples:
raw IP: 33.20.0.1:7777 [2001:db8:1f70::999:de8:7648:6e8]:7777 with NodeID: 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@33.20.0.1:7777 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@[2001:db8:1f70::999:de8:7648:6e8]:7777 without host: 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@
type NodeURLs ¶ added in v0.15.0
type NodeURLs []NodeURL
NodeURLs defines a comma delimited flag for defining a list node url-s.
func ParseNodeURLs ¶ added in v0.15.0
ParseNodeURLs parses comma delimited list of node urls
type Object ¶
type Object struct { Version uint32 Bucket Bucket Path Path IsPrefix bool Metadata map[string]string ContentType string Created time.Time Modified time.Time Expires time.Time Stream }
Object contains information about a specific object
type ObjectList ¶
type ObjectList struct { Bucket string Prefix Path More bool // Items paths are relative to Prefix // To get the full path use list.Prefix + list.Items[0].Path Items []Object }
ObjectList is a list of objects
type PieceID ¶
type PieceID [32]byte
PieceID is the unique identifier for pieces
func PieceIDFromBytes ¶
PieceIDFromBytes converts a byte slice into a piece ID
func PieceIDFromString ¶
PieceIDFromString decodes a hex encoded piece ID string
func (PieceID) Derive ¶
Derive a new PieceID from the current piece ID, the given storage node ID and piece number
func (PieceID) MarshalJSON ¶
MarshalJSON serializes a piece ID to a json string as bytes
func (*PieceID) Size ¶
Size returns the length of a piece ID (implements gogo's custom type interface)
func (*PieceID) UnmarshalJSON ¶
UnmarshalJSON deserializes a json string (as bytes) to a piece ID
type PiecePrivateKey ¶ added in v0.15.0
type PiecePrivateKey struct {
// contains filtered or unexported fields
}
PiecePrivateKey is the unique identifier for pieces
func PiecePrivateKeyFromBytes ¶ added in v0.15.0
func PiecePrivateKeyFromBytes(data []byte) (PiecePrivateKey, error)
PiecePrivateKeyFromBytes converts bytes to a piece private key.
func (PiecePrivateKey) Bytes ¶ added in v0.15.0
func (key PiecePrivateKey) Bytes() []byte
Bytes returns bytes of the piece private key
func (PiecePrivateKey) IsZero ¶ added in v0.15.0
func (key PiecePrivateKey) IsZero() bool
IsZero returns whether the key is empty.
func (PiecePrivateKey) Marshal ¶ added in v0.15.0
func (key PiecePrivateKey) Marshal() ([]byte, error)
Marshal serializes a piece private key
func (*PiecePrivateKey) MarshalTo ¶ added in v0.15.0
func (key *PiecePrivateKey) MarshalTo(data []byte) (n int, err error)
MarshalTo serializes a piece private key into the passed byte slice
func (*PiecePrivateKey) Scan ¶ added in v0.15.0
func (key *PiecePrivateKey) Scan(src interface{}) (err error)
Scan extracts a PiecePrivateKey from a database field
func (PiecePrivateKey) Sign ¶ added in v0.15.0
func (key PiecePrivateKey) Sign(data []byte) ([]byte, error)
Sign signs the message with privateKey and returns a signature.
func (*PiecePrivateKey) Size ¶ added in v0.15.0
func (key *PiecePrivateKey) Size() int
Size returns the length of a piece private key (implements gogo's custom type interface)
func (*PiecePrivateKey) Unmarshal ¶ added in v0.15.0
func (key *PiecePrivateKey) Unmarshal(data []byte) error
Unmarshal deserializes a piece private key
type PiecePublicKey ¶ added in v0.15.0
type PiecePublicKey struct {
// contains filtered or unexported fields
}
PiecePublicKey is the unique identifier for pieces
func PiecePublicKeyFromBytes ¶ added in v0.15.0
func PiecePublicKeyFromBytes(data []byte) (PiecePublicKey, error)
PiecePublicKeyFromBytes converts bytes to a piece public key.
func (PiecePublicKey) Bytes ¶ added in v0.15.0
func (key PiecePublicKey) Bytes() []byte
Bytes returns bytes of the piece public key
func (PiecePublicKey) IsZero ¶ added in v0.15.0
func (key PiecePublicKey) IsZero() bool
IsZero returns whether the key is empty.
func (PiecePublicKey) Marshal ¶ added in v0.15.0
func (key PiecePublicKey) Marshal() ([]byte, error)
Marshal serializes a piece public key
func (*PiecePublicKey) MarshalTo ¶ added in v0.15.0
func (key *PiecePublicKey) MarshalTo(data []byte) (n int, err error)
MarshalTo serializes a piece public key into the passed byte slice
func (*PiecePublicKey) Scan ¶ added in v0.15.0
func (key *PiecePublicKey) Scan(src interface{}) (err error)
Scan extracts a PiecePublicKey from a database field
func (*PiecePublicKey) Size ¶ added in v0.15.0
func (key *PiecePublicKey) Size() int
Size returns the length of a piece public key (implements gogo's custom type interface)
func (*PiecePublicKey) Unmarshal ¶ added in v0.15.0
func (key *PiecePublicKey) Unmarshal(data []byte) error
Unmarshal deserializes a piece public key
func (PiecePublicKey) Value ¶ added in v0.15.0
func (key PiecePublicKey) Value() (driver.Value, error)
Value set a PiecePublicKey to a database field
func (PiecePublicKey) Verify ¶ added in v0.15.0
func (key PiecePublicKey) Verify(data, signature []byte) error
Verify reports whether signature is a valid signature of message by publicKey.
type ReadOnlyStream ¶
type ReadOnlyStream interface { Info() Object // SegmentsAt returns the segment that contains the byteOffset and following segments. // Limit specifies how much to return at most. SegmentsAt(ctx context.Context, byteOffset int64, limit int64) (infos []Segment, more bool, err error) // Segments returns the segment at index. // Limit specifies how much to return at most. Segments(ctx context.Context, index int64, limit int64) (infos []Segment, more bool, err error) }
ReadOnlyStream is an interface for reading segment information
type RedundancyAlgorithm ¶
type RedundancyAlgorithm byte
RedundancyAlgorithm is the algorithm used for redundancy
type RedundancyScheme ¶
type RedundancyScheme struct { // Algorithm determines the algorithm to be used for redundancy. Algorithm RedundancyAlgorithm ShareSize int32 // stripe, reed-solomon k. RequiredShares int16 // before a repair is triggered. RepairShares int16 OptimalShares int16 // OptimalShares, slower uploads of the excess shares will be aborted in // order to improve performance. TotalShares int16 }
RedundancyScheme specifies the parameters and the algorithm for redundancy
func (RedundancyScheme) IsZero ¶
func (scheme RedundancyScheme) IsZero() bool
IsZero returns true if no field in the struct is set to non-zero value
func (RedundancyScheme) StripeSize ¶ added in v0.13.0
func (scheme RedundancyScheme) StripeSize() int32
StripeSize is the number of bytes for a stripe. Stripes are erasure encoded and split into n shares, where we need k to reconstruct the stripe. Therefore a stripe size is the erasure share size times the required shares, k.
type Segment ¶
type Segment struct { Index int64 // Size is the size of the content in bytes Size int64 // Checksum is the checksum of the content Checksum []byte // Local data Inline []byte // Remote data PieceID PieceID Pieces []Piece // Encryption EncryptedKeyNonce Nonce EncryptedKey EncryptedPrivateKey }
Segment is full segment information
type SerialNumber ¶
type SerialNumber [16]byte
SerialNumber is the unique identifier for pieces
func SerialNumberFromBytes ¶
func SerialNumberFromBytes(b []byte) (SerialNumber, error)
SerialNumberFromBytes converts a byte slice into a serial number
func SerialNumberFromString ¶
func SerialNumberFromString(s string) (SerialNumber, error)
SerialNumberFromString decodes an base32 encoded
func (SerialNumber) Bytes ¶
func (id SerialNumber) Bytes() []byte
Bytes returns bytes of the serial number
func (SerialNumber) IsZero ¶
func (id SerialNumber) IsZero() bool
IsZero returns whether serial number is unassigned
func (SerialNumber) Marshal ¶
func (id SerialNumber) Marshal() ([]byte, error)
Marshal serializes a serial number
func (SerialNumber) MarshalJSON ¶
func (id SerialNumber) MarshalJSON() ([]byte, error)
MarshalJSON serializes a serial number to a json string as bytes
func (*SerialNumber) MarshalTo ¶
func (id *SerialNumber) MarshalTo(data []byte) (n int, err error)
MarshalTo serializes a serial number into the passed byte slice
func (*SerialNumber) Scan ¶
func (id *SerialNumber) Scan(src interface{}) (err error)
Scan extracts a SerialNumber from a database field
func (*SerialNumber) Size ¶
func (id *SerialNumber) Size() int
Size returns the length of a serial number (implements gogo's custom type interface)
func (SerialNumber) String ¶
func (id SerialNumber) String() string
String representation of the serial number
func (*SerialNumber) Unmarshal ¶
func (id *SerialNumber) Unmarshal(data []byte) error
Unmarshal deserializes a serial number
func (*SerialNumber) UnmarshalJSON ¶
func (id *SerialNumber) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes a json string (as bytes) to a serial number
type Stream ¶
type Stream struct { // Size is the total size of the stream in bytes Size int64 // Checksum is the checksum of the segment checksums Checksum []byte // SegmentCount is the number of segments SegmentCount int64 // FixedSegmentSize is the size of each segment, // when all segments have the same size. It is -1 otherwise. FixedSegmentSize int64 // RedundancyScheme specifies redundancy strategy used for this stream RedundancyScheme // EncryptionParameters specifies encryption strategy used for this stream EncryptionParameters LastSegment LastSegment // TODO: remove }
Stream is information about an object stream
type StreamID ¶ added in v0.15.0
type StreamID [16]byte
StreamID is the unique identifier for stream related to object
func StreamIDFromBytes ¶ added in v0.15.0
StreamIDFromBytes converts a byte slice into a stream ID
func StreamIDFromString ¶ added in v0.15.0
StreamIDFromString decodes an base32 encoded
func (StreamID) MarshalJSON ¶ added in v0.15.0
MarshalJSON serializes a stream ID to a json string as bytes
func (*StreamID) MarshalTo ¶ added in v0.15.0
MarshalTo serializes a stream ID into the passed byte slice
func (*StreamID) Size ¶ added in v0.15.0
Size returns the length of a stream ID (implements gogo's custom type interface)
func (*StreamID) UnmarshalJSON ¶ added in v0.15.0
UnmarshalJSON deserializes a json string (as bytes) to a stream ID