Documentation ¶
Index ¶
- type RandomCopier
- func (m *RandomCopier) Pull(ctx context.Context, id, storIndex, fileID string, node *blockchain.Node) (io.ReadCloser, error)
- func (m *RandomCopier) Push(ctx context.Context, id, sourceID string, r io.Reader, node *blockchain.Node) (string, error)
- func (m *RandomCopier) ReplicaExpansion(ctx context.Context, opt *copier.ReplicaExpOptions, enc common.CommonEncryptor, ...) (nSlice []blockchain.PublicSliceMeta, eSlices []encryptor.EncryptedSlice, ...)
- func (m *RandomCopier) Select(slice slicer.Slice, nodes blockchain.NodeHs, opt *copier.SelectOptions) (copier.LocatedSlice, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RandomCopier ¶
type RandomCopier struct {
// contains filtered or unexported fields
}
RandomCopier selects Storage Nodes randomly from healthy candidates.
You can call Push() to push slices onto Storage Node, and Pull() to pull slices from Storage Node. If you want more Storage Nodes, you can call ReplicaExpansion(), and it pulls slices from original nodes and decrypts and re-encrypts those slices, then push them onto new Storage Nodes.
func New ¶
func New(privkey ecdsa.PrivateKey) *RandomCopier
func (*RandomCopier) Pull ¶
func (m *RandomCopier) Pull(ctx context.Context, id, storIndex, fileID string, node *blockchain.Node) (io.ReadCloser, error)
Pull pulls slice from storage no
func (*RandomCopier) Push ¶
func (m *RandomCopier) Push(ctx context.Context, id, sourceID string, r io.Reader, node *blockchain.Node) (string, error)
Push pushes slices onto Storage Node returns storage index of slice
func (*RandomCopier) ReplicaExpansion ¶
func (m *RandomCopier) ReplicaExpansion(ctx context.Context, opt *copier.ReplicaExpOptions, enc common.CommonEncryptor, challengeAlgorithm, sourceID, fileID string) ( nSlice []blockchain.PublicSliceMeta, eSlices []encryptor.EncryptedSlice, err error)
ReplicaExpansion slice performs Replica-Expand, that is to
pull slices from original nodes and decrypt and re-encrypt those slices, then push them onto new Storage Nodes.
func (*RandomCopier) Select ¶
func (m *RandomCopier) Select(slice slicer.Slice, nodes blockchain.NodeHs, opt *copier.SelectOptions) ( copier.LocatedSlice, error)
Select selects nodes for a slice randomly from healthy candidates
Click to show internal directories.
Click to hide internal directories.