Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SplitSlabs ¶
SplitSlabs splits a set of slabs into slices comprising objects with the specified lengths.
Types ¶
type EncryptionKey ¶
type EncryptionKey struct {
// contains filtered or unexported fields
}
A EncryptionKey can encrypt and decrypt messages.
func GenerateEncryptionKey ¶
func GenerateEncryptionKey() EncryptionKey
GenerateEncryptionKey returns a random encryption key.
func (EncryptionKey) Decrypt ¶
func (k EncryptionKey) Decrypt(w io.Writer, offset int64) cipher.StreamWriter
Decrypt returns a cipher.StreamWriter that decrypts w with k, starting at the specified offset.
func (EncryptionKey) Encrypt ¶
func (k EncryptionKey) Encrypt(r io.Reader) cipher.StreamReader
Encrypt returns a cipher.StreamReader that encrypts r with k.
func (EncryptionKey) MarshalText ¶
func (k EncryptionKey) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (EncryptionKey) String ¶
func (k EncryptionKey) String() string
String implements fmt.Stringer.
func (*EncryptionKey) UnmarshalText ¶
func (k *EncryptionKey) UnmarshalText(b []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Object ¶
type Object struct { Key EncryptionKey Slabs []SlabSlice }
An Object is a unit of data that has been stored on a host.
type Slab ¶
type Slab struct { Key EncryptionKey MinShards uint8 Shards []Sector }
A Slab is raw data that has been erasure-encoded into sector-sized shards, encrypted, and stored across a set of hosts. A distinct EncryptionKey should be used for each Slab, and should not be the same key used for the parent Object.
func (Slab) Encode ¶
Encode encodes slab data into sector-sized shards. The supplied shards should have a capacity of at least rhpv2.SectorSize, or they will be reallocated.
func (Slab) Encrypt ¶
Encrypt xors shards with the keystream derived from s.Key, using a different nonce for each shard.
func (Slab) Reconstruct ¶
Reconstruct reconstructs the missing shards of a slab. Missing shards must have a len of zero. All shards should have a capacity of at least rhpv2.SectorSize, or they will be reallocated.
type SlabSlice ¶
A SlabSlice is a contiguous region within a Slab. Note that the offset and length always refer to the reconstructed data, and therefore may not necessarily be aligned to a leaf or chunk boundary. Use the SectorRegion method to compute the chunk-aligned offset and length.
func SingleSlabs ¶
SingleSlabs converts a set of slabs into slices comprising a single object with the specified length.
func (SlabSlice) Decrypt ¶
Decrypt xors shards with the keystream derived from s.Key (starting at the slice offset), using a different nonce for each shard.
func (SlabSlice) SectorRegion ¶
SectorRegion returns the offset and length of the sector region that must be downloaded in order to recover the data referenced by the SlabSlice.