Documentation ¶
Index ¶
- Constants
- Variables
- type Constructor
- func (c *Constructor) Reconstruct(parts []*objectSDK.Object) (*objectSDK.Object, error)
- func (c *Constructor) ReconstructHeader(parts []*objectSDK.Object) (*objectSDK.Object, error)
- func (c *Constructor) ReconstructParts(parts []*objectSDK.Object, required []bool, key *ecdsa.PrivateKey) error
- func (c *Constructor) Split(obj *objectSDK.Object, key *ecdsa.PrivateKey) ([]*objectSDK.Object, error)
- func (c *Constructor) Verify(parts []*objectSDK.Object) error
- type ObjectWriter
- type Target
Constants ¶
const MaxShardCount = 256
MaxShardCount is the maximum number of shards.
Variables ¶
var ( // ErrMalformedSlice is returned when a slice of EC chunks is inconsistent. ErrMalformedSlice = errors.New("inconsistent EC headers") // ErrInvShardNum is returned from NewConstructor when the number of shards is invalid. ErrInvShardNum = reedsolomon.ErrInvShardNum // ErrMaxShardNum is returned from NewConstructor when the number of shards is too big. ErrMaxShardNum = reedsolomon.ErrMaxShardNum )
Functions ¶
This section is empty.
Types ¶
type Constructor ¶
type Constructor struct {
// contains filtered or unexported fields
}
Constructor is a wrapper around encoder allowing to reconstruct objects. It's methods are not thread-safe.
func NewConstructor ¶
func NewConstructor(dataCount int, parityCount int) (*Constructor, error)
NewConstructor returns new constructor instance.
func (*Constructor) Reconstruct ¶
Reconstruct returns full object reconstructed from parts. All non-nil objects in parts must have EC header with the same `total` field equal to len(parts). The slice must contain at least one non nil object. Index of the objects in parts must be equal to it's index field in the EC header. The parts slice isn't changed and can be used concurrently for reading.
func (*Constructor) ReconstructHeader ¶
ReconstructHeader returns object header reconstructed from parts. All non-nil objects in parts must have EC header with the same `total` field equal to len(parts). The slice must contain at least one non nil object. Index of the objects in parts must be equal to it's index field in the EC header. The parts slice isn't changed and can be used concurrently for reading.
func (*Constructor) ReconstructParts ¶
func (c *Constructor) ReconstructParts(parts []*objectSDK.Object, required []bool, key *ecdsa.PrivateKey) error
ReconstructParts reconstructs specific EC parts without reconstructing full object. All non-nil objects in parts must have EC header with the same `total` field equal to len(parts). The slice must contain at least one non nil object. Index of the objects in parts must be equal to it's index field in the EC header. Those parts for which corresponding element in required is true must be nil and will be overwritten. Because partial reconstruction only makes sense for full objects, all parts must have non-empty payload. If key is not nil, all reconstructed parts are signed with this key.
func (*Constructor) Split ¶
func (c *Constructor) Split(obj *objectSDK.Object, key *ecdsa.PrivateKey) ([]*objectSDK.Object, error)
Split splits fully formed object into multiple chunks.
type ObjectWriter ¶
ObjectWriter is an interface of the object writer that writes prepared object.
type Target ¶
type Target struct {
// contains filtered or unexported fields
}
Target accepts regular objects and splits them into erasure-coded chunks.
func NewTarget ¶
func NewTarget(c *Constructor, key *ecdsa.PrivateKey, next ObjectWriter) *Target
NewTarget returns new target instance.