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 CipherSuite
- type EncryptedPrivateKey
- type EncryptionParameters
- type IDVersion
- type IDVersionNumber
- type Key
- type NodeID
- func (id NodeID) Bytes() []byte
- func (id NodeID) Compare(other NodeID) int
- func (id *NodeID) DecodeSpanner(val any) (err error)
- func (id NodeID) Difficulty() (uint16, error)
- func (id NodeID) EncodeSpanner() (any, error)
- func (id *NodeID) IsZero() bool
- func (id NodeID) Less(other NodeID) bool
- func (id NodeID) Marshal() ([]byte, error)
- func (id NodeID) MarshalText() ([]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) UnmarshalText(data []byte) error
- func (id NodeID) Value() (driver.Value, error)
- func (id NodeID) Version() IDVersion
- type NodeIDList
- type NodeURL
- type NodeURLs
- type NoiseInfo
- type NoiseProto
- type Nonce
- func (nonce Nonce) Bytes() []byte
- func (nonce *Nonce) DecodeSpanner(input any) error
- func (nonce Nonce) EncodeSpanner() (any, error)
- func (nonce *Nonce) IsZero() bool
- func (nonce Nonce) Marshal() ([]byte, error)
- func (nonce Nonce) MarshalText() ([]byte, error)
- func (nonce *Nonce) MarshalTo(data []byte) (n int, err error)
- func (nonce *Nonce) Raw() *[NonceSize]byte
- func (nonce *Nonce) Scan(src interface{}) (err error)
- func (nonce Nonce) Size() int
- func (nonce Nonce) String() string
- func (nonce *Nonce) Unmarshal(data []byte) error
- func (nonce *Nonce) UnmarshalText(data []byte) error
- func (nonce Nonce) Value() (driver.Value, error)
- type Path
- type PieceID
- func (id PieceID) Bytes() []byte
- func (id *PieceID) DecodeSpanner(val any) (err error)
- func (id PieceID) Derive(storagenodeID NodeID, pieceNum int32) PieceID
- func (id PieceID) Deriver() PieceIDDeriver
- func (id PieceID) EncodeSpanner() (any, error)
- func (id *PieceID) IsZero() bool
- func (id PieceID) Marshal() ([]byte, error)
- func (id PieceID) MarshalText() ([]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) UnmarshalText(data []byte) error
- func (id PieceID) Value() (driver.Value, error)
- type PieceIDDeriver
- 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) MarshalText() ([]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) UnmarshalText(data []byte) error
- func (key PiecePublicKey) Value() (driver.Value, error)
- func (key PiecePublicKey) Verify(data, signature []byte) error
- type PlacementConstraint
- type RedundancyAlgorithm
- type RedundancyScheme
- type RetentionMode
- type SegmentID
- func (id SegmentID) Bytes() []byte
- func (id SegmentID) IsZero() bool
- func (id SegmentID) Marshal() ([]byte, error)
- func (id SegmentID) MarshalText() ([]byte, error)
- func (id *SegmentID) MarshalTo(data []byte) (n int, err error)
- func (id SegmentID) Size() int
- func (id SegmentID) String() string
- func (id *SegmentID) Unmarshal(data []byte) error
- func (id *SegmentID) UnmarshalText(data []byte) error
- type SerialNumber
- func (id SerialNumber) Bytes() []byte
- func (id SerialNumber) IsZero() bool
- func (id SerialNumber) Less(other SerialNumber) bool
- func (id SerialNumber) Marshal() ([]byte, error)
- func (id SerialNumber) MarshalText() ([]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) UnmarshalText(data []byte) error
- func (id SerialNumber) Value() (driver.Value, error)
- type StreamID
- func (id StreamID) Bytes() []byte
- func (id *StreamID) DecodeSpanner(val any) (err error)
- func (id StreamID) EncodeSpanner() (any, error)
- func (id StreamID) IsZero() bool
- func (id StreamID) Marshal() ([]byte, error)
- func (id StreamID) MarshalText() ([]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) UnmarshalText(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 // EncNullBase64URL is like EncNull but Base64 encodes/decodes the // binary path data (URL-safe). EncNullBase64URL )
const ( KeySize = 32 NonceSize = 24 )
Constant definitions for key and nonce sizes.
const ( // NoiseProto_Unset is an unset protocol. NoiseProto_Unset = 0 // NoiseProto_IK_25519_ChaChaPoly_BLAKE2b is a Noise protocol. NoiseProto_IK_25519_ChaChaPoly_BLAKE2b = 1 // NoiseProto_IK_25519_AESGCM_BLAKE2b is a Noise protocol. NoiseProto_IK_25519_AESGCM_BLAKE2b = 2 )
const ( InvalidRedundancyAlgorithm = RedundancyAlgorithm(iota) ReedSolomon )
List of supported redundancy algorithms.
const NodeIDSize = 32
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 ( // 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") // ErrVersion is used for identity version related errors. ErrVersion = errs.Class("node ID version") )
var ErrEncryptedPrivateKey = errs.Class("encryptedprivatekey")
ErrEncryptedPrivateKey is used when something goes wrong with an encrypted private key.
var ( // ErrNodeURL is used when something goes wrong with a node url. ErrNodeURL = errs.Class("node URL") )
var ErrNonce = errs.Class("nonce")
ErrNonce is used when something goes wrong with a stream ID.
var ErrPieceID = errs.Class("piece ID")
ErrPieceID is used when something goes wrong with a piece ID.
var ErrPieceKey = errs.Class("piece key")
ErrPieceKey is used when something goes wrong with a piece key.
var ErrSegmentID = errs.Class("segment ID")
ErrSegmentID is used when something goes wrong with a segment ID.
var ErrSerialNumber = errs.Class("serial number")
ErrSerialNumber is used when something goes wrong with a serial number.
var ErrStreamID = errs.Class("stream ID")
ErrStreamID is used when something goes wrong with a stream ID.
Functions ¶
func IDVersionInVersions ¶
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 ¶
func NewPieceKey() (PiecePublicKey, PiecePrivateKey, error)
NewPieceKey creates a piece key pair.
func NewVersionExt ¶
NewVersionExt creates a new identity version certificate extension for the given identity version.
Types ¶
type CipherSuite ¶
type CipherSuite byte
CipherSuite specifies one of the encryption suites supported by Storj libraries for encryption of in-network data.
func (CipherSuite) String ¶
func (suite CipherSuite) String() string
String representation of the cipher suite.
type EncryptedPrivateKey ¶
type EncryptedPrivateKey []byte
EncryptedPrivateKey is a private key that has been encrypted.
func (*EncryptedPrivateKey) DecodeSpanner ¶
func (pkey *EncryptedPrivateKey) DecodeSpanner(val any) (err error)
DecodeSpanner implements spanner.Decoder.
func (EncryptedPrivateKey) EncodeSpanner ¶
func (pkey EncryptedPrivateKey) EncodeSpanner() (any, error)
EncodeSpanner implements spanner.Encoder.
func (*EncryptedPrivateKey) Scan ¶
func (pkey *EncryptedPrivateKey) Scan(src interface{}) (err error)
Scan extracts a EncryptedPrivateKey from a database field.
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 ¶
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 ¶
func IDVersionFromCert(cert *x509.Certificate) (IDVersion, error)
IDVersionFromCert parsed the IDVersion from the passed certificate's IDVersion extension.
func LatestIDVersion ¶
func LatestIDVersion() IDVersion
LatestIDVersion returns the last IDVersion registered.
type IDVersionNumber ¶
type IDVersionNumber uint8
IDVersionNumber is the number of an identity version.
type Key ¶
Key represents the largest key used by any encryption protocol.
type NodeID ¶
type NodeID [NodeIDSize]byte
NodeID is a unique node identifier.
func NewVersionedID ¶
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) Compare ¶
Compare returns an integer comparing id and other lexicographically. The result will be 0 if id==other, -1 if id < other, and +1 if id > other.
func (*NodeID) DecodeSpanner ¶
DecodeSpanner implements spanner.Decoder.
func (NodeID) Difficulty ¶
Difficulty returns the number of trailing zero bits in a node ID.
func (NodeID) EncodeSpanner ¶
EncodeSpanner implements spanner.Encoder.
func (NodeID) MarshalText ¶
MarshalText serializes a node ID to a base58 string.
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) UnmarshalText ¶
UnmarshalText deserializes a base58 string 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) Contains ¶
func (n NodeIDList) Contains(id NodeID) bool
Contains tests if the node IDs contain id.
func (NodeIDList) Less ¶
func (n NodeIDList) Less(i, j int) bool
Less implements sort.Interface.Less().
func (NodeIDList) Strings ¶
func (n NodeIDList) Strings() []string
Strings returns a string slice of the node IDs.
func (NodeIDList) Unique ¶
func (n NodeIDList) Unique() NodeIDList
Unique returns slice of the unique node IDs.
type NodeURL ¶
type NodeURL struct { ID NodeID Address string NoiseInfo NoiseInfo DebounceLimit int Features uint64 // this is a bitmask of pb.NodeAddress_Feature values. }
NodeURL defines a structure for connecting to a node.
func ParseNodeURL ¶
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@ with noise information: 12vha9oTFnerxYRgeQ2BZqoFrLrnmmf5UWTCY2jA77dF3YvWew7@33.20.0.1:7777?noise_pub=12vha9oTFnerxY&noise_proto=1
type NodeURLs ¶
type NodeURLs []NodeURL
NodeURLs defines a comma delimited flag for defining a list node url-s.
func ParseNodeURLs ¶
ParseNodeURLs parses comma delimited list of node urls.
type NoiseInfo ¶
type NoiseInfo struct { Proto NoiseProto PublicKey string // byte representation }
NoiseInfo represents the information needed to dial a remote Noise peer.
type NoiseProto ¶
type NoiseProto int
NoiseProto represents different possible Noise handshake and cipher suite selections.
type Nonce ¶
Nonce represents the largest nonce used by any encryption protocol.
func NonceFromBytes ¶
NonceFromBytes converts a byte slice into a nonce.
func NonceFromString ¶
NonceFromString decodes an base32 encoded.
func (*Nonce) DecodeSpanner ¶
DecodeSpanner decodes a nonce from Spanner storage.
func (Nonce) EncodeSpanner ¶
EncodeSpanner encodes a nonce for storing in Spanner.
func (Nonce) MarshalText ¶
MarshalText serializes a nonce to a base32 string.
func (*Nonce) UnmarshalText ¶
UnmarshalText deserializes a base32 string to a nonce.
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) DecodeSpanner ¶
DecodeSpanner implements spanner.Decoder.
func (PieceID) Derive ¶
Derive a new PieceID from the current piece ID, the given storage node ID and piece number.
func (PieceID) Deriver ¶
func (id PieceID) Deriver() PieceIDDeriver
Deriver creates piece ID dervier for multiple derive operations.
func (PieceID) EncodeSpanner ¶
EncodeSpanner implements spanner.Encoder.
func (PieceID) MarshalText ¶
MarshalText serializes a piece ID to a base32 string.
func (*PieceID) Size ¶
Size returns the length of a piece ID (implements gogo's custom type interface).
func (*PieceID) UnmarshalText ¶
UnmarshalText deserializes a base32 string to a piece ID.
type PieceIDDeriver ¶
type PieceIDDeriver struct {
// contains filtered or unexported fields
}
PieceIDDeriver can be used to for multiple derivation from the same PieceID without need to initialize mac for each Derive call.
func (PieceIDDeriver) Derive ¶
func (pd PieceIDDeriver) Derive(storagenodeID NodeID, pieceNum int32) PieceID
Derive a new PieceID from the piece ID, the given storage node ID and piece number. Initial mac is created from piece ID once while creating PieceDeriver and just reset to initial state at the beginning of each call.
type PiecePrivateKey ¶
type PiecePrivateKey struct {
// contains filtered or unexported fields
}
PiecePrivateKey is the unique identifier for pieces.
func PiecePrivateKeyFromBytes ¶
func PiecePrivateKeyFromBytes(data []byte) (PiecePrivateKey, error)
PiecePrivateKeyFromBytes converts bytes to a piece private key.
func (PiecePrivateKey) Bytes ¶
func (key PiecePrivateKey) Bytes() []byte
Bytes returns bytes of the piece private key.
func (PiecePrivateKey) IsZero ¶
func (key PiecePrivateKey) IsZero() bool
IsZero returns whether the key is empty.
func (PiecePrivateKey) Marshal ¶
func (key PiecePrivateKey) Marshal() ([]byte, error)
Marshal serializes a piece private key.
func (*PiecePrivateKey) MarshalTo ¶
func (key *PiecePrivateKey) MarshalTo(data []byte) (n int, err error)
MarshalTo serializes a piece private key into the passed byte slice.
func (*PiecePrivateKey) Scan ¶
func (key *PiecePrivateKey) Scan(src interface{}) (err error)
Scan extracts a PiecePrivateKey from a database field.
func (PiecePrivateKey) Sign ¶
func (key PiecePrivateKey) Sign(data []byte) ([]byte, error)
Sign signs the message with privateKey and returns a signature.
func (*PiecePrivateKey) Size ¶
func (key *PiecePrivateKey) Size() int
Size returns the length of a piece private key (implements gogo's custom type interface).
func (*PiecePrivateKey) Unmarshal ¶
func (key *PiecePrivateKey) Unmarshal(data []byte) error
Unmarshal deserializes a piece private key.
type PiecePublicKey ¶
type PiecePublicKey struct {
// contains filtered or unexported fields
}
PiecePublicKey is the unique identifier for pieces.
func PiecePublicKeyFromBytes ¶
func PiecePublicKeyFromBytes(data []byte) (PiecePublicKey, error)
PiecePublicKeyFromBytes converts bytes to a piece public key.
func (PiecePublicKey) Bytes ¶
func (key PiecePublicKey) Bytes() []byte
Bytes returns bytes of the piece public key.
func (PiecePublicKey) IsZero ¶
func (key PiecePublicKey) IsZero() bool
IsZero returns whether the key is empty.
func (PiecePublicKey) Marshal ¶
func (key PiecePublicKey) Marshal() ([]byte, error)
Marshal serializes a piece public key.
func (*PiecePublicKey) MarshalText ¶
func (key *PiecePublicKey) MarshalText() ([]byte, error)
MarshalText serializes a piece public key to a base32 string.
func (*PiecePublicKey) MarshalTo ¶
func (key *PiecePublicKey) MarshalTo(data []byte) (n int, err error)
MarshalTo serializes a piece public key into the passed byte slice.
func (*PiecePublicKey) Scan ¶
func (key *PiecePublicKey) Scan(src interface{}) (err error)
Scan extracts a PiecePublicKey from a database field.
func (*PiecePublicKey) Size ¶
func (key *PiecePublicKey) Size() int
Size returns the length of a piece public key (implements gogo's custom type interface).
func (*PiecePublicKey) Unmarshal ¶
func (key *PiecePublicKey) Unmarshal(data []byte) error
Unmarshal deserializes a piece public key.
func (*PiecePublicKey) UnmarshalText ¶
func (key *PiecePublicKey) UnmarshalText(data []byte) error
UnmarshalText deserializes a base32 string to a piece public key.
func (PiecePublicKey) Value ¶
func (key PiecePublicKey) Value() (driver.Value, error)
Value set a PiecePublicKey to a database field.
func (PiecePublicKey) Verify ¶
func (key PiecePublicKey) Verify(data, signature []byte) error
Verify reports whether signature is a valid signature of message by publicKey.
type PlacementConstraint ¶
type PlacementConstraint uint16
PlacementConstraint is the ID of the placement/geofencing rule.
const ( // DefaultPlacement placement is used, when no specific placement rule is defined. DefaultPlacement PlacementConstraint = 0 // EveryCountry includes all countries. // Deprecated: use DefaultPlacement, which may exclude some nodes based on placement configuration. EveryCountry PlacementConstraint = 0 // EU includes only the 27 members of European Union. // Deprecated: placement definitions depend on the configuration. EU PlacementConstraint = 1 // EEA defines the European Economic Area (EU + 3 countries), the area where GDPR is valid. // Deprecated: placement definitions depend on the configuration. EEA PlacementConstraint = 2 // US filters nodes only from the United States. // Deprecated: placement definitions depend on the configuration. US PlacementConstraint = 3 // DE placement uses nodes only from Germany. // Deprecated: placement definitions depend on the configuration. DE PlacementConstraint = 4 // InvalidPlacement is used when there is no information about the stored placement. // Deprecated: placement definitions depend on the configuration. InvalidPlacement PlacementConstraint = 5 // NR placement uses nodes that are not in RU or other countries sanctioned because of the RU/UA War. // Deprecated: placement definitions depend on the configuration. NR PlacementConstraint = 6 )
func (*PlacementConstraint) DecodeSpanner ¶
func (p *PlacementConstraint) DecodeSpanner(input any) error
DecodeSpanner implements spanner.Decoder.
func (PlacementConstraint) EncodeSpanner ¶
func (p PlacementConstraint) EncodeSpanner() (any, error)
EncodeSpanner implements spanner.Encoder.
func (*PlacementConstraint) Scan ¶
func (p *PlacementConstraint) Scan(value interface{}) error
Scan implements the sql.Scanner interface.
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) PieceSize ¶
func (scheme RedundancyScheme) PieceSize(size int64) int64
PieceSize calculates piece size for give size.
func (RedundancyScheme) StripeCount ¶
func (scheme RedundancyScheme) StripeCount(encryptedSegmentSize int32) int32
StripeCount returns segment's total number of stripes based on segment's encrypted size.
func (RedundancyScheme) StripeSize ¶
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 RetentionMode ¶
type RetentionMode uint8
RetentionMode represents the retention mode of an object version.
const ( // NoRetention signifies that a retention period has not been set on an object version. NoRetention RetentionMode = 0 // ComplianceMode signifies that an object version is locked in compliance mode // and cannot be deleted or modified until the retention period expires. ComplianceMode RetentionMode = 1 // GovernanceMode signifies that an object version is locked in governance mode // and cannot be deleted or modified until the retention period expires or the lock is removed. GovernanceMode RetentionMode = 2 )
type SegmentID ¶
type SegmentID []byte
SegmentID is the unique identifier for segment related to object.
func SegmentIDFromBytes ¶
SegmentIDFromBytes converts a byte slice into a segment ID.
func SegmentIDFromString ¶
SegmentIDFromString decodes an base32 encoded.
func (SegmentID) Marshal ¶
Marshal serializes a segment ID (implements gogo's custom type interface).
func (SegmentID) MarshalText ¶
MarshalText serializes a segment ID to a base32 string.
func (*SegmentID) MarshalTo ¶
MarshalTo serializes a segment ID into the passed byte slice (implements gogo's custom type interface).
func (SegmentID) Size ¶
Size returns the length of a segment ID (implements gogo's custom type interface).
func (*SegmentID) Unmarshal ¶
Unmarshal deserializes a segment ID (implements gogo's custom type interface).
func (*SegmentID) UnmarshalText ¶
UnmarshalText deserializes a base32 string to a segment ID.
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) Less ¶
func (id SerialNumber) Less(other SerialNumber) bool
Less returns whether id is smaller than other in lexicographic order.
func (SerialNumber) Marshal ¶
func (id SerialNumber) Marshal() ([]byte, error)
Marshal serializes a serial number.
func (SerialNumber) MarshalText ¶
func (id SerialNumber) MarshalText() ([]byte, error)
MarshalText serializes a serial number to a base32 string.
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) UnmarshalText ¶
func (id *SerialNumber) UnmarshalText(data []byte) error
UnmarshalText deserializes a base32 string to a serial number.
type StreamID ¶
type StreamID []byte
StreamID is the unique identifier for stream related to object.
func StreamIDFromBytes ¶
StreamIDFromBytes converts a byte slice into a stream ID.
func StreamIDFromString ¶
StreamIDFromString decodes an base32 encoded.
func (*StreamID) DecodeSpanner ¶
DecodeSpanner implements spanner.Decoder.
func (StreamID) EncodeSpanner ¶
EncodeSpanner implements spanner.Encoder.
func (StreamID) MarshalText ¶
MarshalText serializes a stream ID to a base32 string.
func (StreamID) Size ¶
Size returns the length of a stream ID (implements gogo's custom type interface).
func (*StreamID) UnmarshalText ¶
UnmarshalText deserializes a base32 string to a stream ID.