random

package
v0.0.0-...-ebe581b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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

Select selects nodes for a slice randomly from healthy candidates

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL