filemaintainer

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: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain interface {
	PublishFile(file *blockchain.PublishFileOptions) error
	ListFiles(opt *blockchain.ListFileOptions) ([]blockchain.File, error)
	GetFileByID(id string) (blockchain.File, error)
	ListFileNs(opt *blockchain.ListNsOptions) ([]blockchain.Namespace, error)
	UpdateFilePublicSliceMeta(opt *blockchain.UpdateFilePSMOptions) error
	SliceMigrateRecord(opt *blockchain.SliceMigrateOptions) error

	ListNodes() (blockchain.Nodes, error)
	GetNode(id []byte) (blockchain.Node, error)
	GetNodeHealth(id []byte) (string, error)
	GetHeartbeatNum(id []byte, timestamp int64) (int, error)
}

type Challenger

type Challenger interface {
	// merkle Challenge
	Setup(sliceData []byte, rangeAmount int) ([]ctype.RangeHash, error)
	Save(cms []ctype.Material) error
	Take(fileID string, sliceID string, nodeID []byte) (ctype.RangeHash, error)

	GetChallengeConf() (string, types.PairingChallengeConf)
	Close()
}

type Copier

type Copier interface {
	Push(ctx context.Context, id, sourceID string, r io.Reader, node *blockchain.Node) (string, error)
	Pull(ctx context.Context, id, storIndex, fileID string, node *blockchain.Node) (io.ReadCloser, error)
	ReplicaExpansion(ctx context.Context, opt *copier.ReplicaExpOptions, enc common.CommonEncryptor,
		challengeAlgorithm, sourceID, fileID string) ([]blockchain.PublicSliceMeta, []encryptor.EncryptedSlice, error)
}

type Encryptor

type Encryptor interface {
	Encrypt(r io.Reader, opt *encryptor.EncryptOptions) (encryptor.EncryptedSlice, error)
	Recover(r io.Reader, opt *encryptor.RecoverOptions) ([]byte, error)
}

type FileMaintainer

type FileMaintainer struct {
	// contains filtered or unexported fields
}

FileMaintainer runs if local node is dataOwner-node, and its main work is to check storage-nodes health conditions

and migrate slices from bad nodes to healthy nodes.

func New

func (*FileMaintainer) Migrate

func (m *FileMaintainer) Migrate(ctx context.Context)

Migrate starts file migration

func (*FileMaintainer) StopMigrate

func (m *FileMaintainer) StopMigrate()

StopMigrate stops file migration

type NewFileMaintainerOptions

type NewFileMaintainerOptions struct {
	LocalNode  peer.Local
	Blockchain Blockchain
	Copier     Copier
	Encryptor  Encryptor
	Challenger Challenger
}

Jump to

Keyboard shortcuts

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