Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultRequestInterval = time.Minute * 60
)
Variables ¶
This section is empty.
Functions ¶
func Calculate ¶
func Calculate(opt *ctype.CalculateOptions) []byte
Types ¶
type Blockchain ¶
type Blockchain interface { ListFiles(opt *blockchain.ListFileOptions) ([]blockchain.File, error) ListFileNs(opt *blockchain.ListNsOptions) ([]blockchain.Namespace, error) ListChallengeRequests(opt *blockchain.ListChallengeOptions) ([]blockchain.Challenge, error) ChallengeRequest(opt *blockchain.ChallengeRequestOptions) error ChallengeAnswer(opt *blockchain.ChallengeAnswerOptions) ([]byte, error) NodeOffline(opt *blockchain.NodeOperateOptions) error }
type ChallengeDB ¶
type ChallengeDB interface { GenerateChallenge(sliceIdxList []int, interval int64) ([][]byte, [][]byte, int64, []byte, error) // 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) }
type ChallengingMonitor ¶
type ChallengingMonitor struct { PrivateKey ecdsa.PrivateKey AnswerInterval time.Duration RequestInterval time.Duration // contains filtered or unexported fields }
ChallengingMonitor's main work is to publish challenge requests if local node is dataOwner-node,
otherwise is to listen challenge requests and answer them in order to prove it's storing related files
func New ¶
func New(conf *config.MonitorConf, opt *NewChallengingMonitorOptions) (*ChallengingMonitor, error)
func (*ChallengingMonitor) StartChallengeAnswer ¶
func (c *ChallengingMonitor) StartChallengeAnswer(ctx context.Context)
StartChallengeAnswer starts to answer request
func (*ChallengingMonitor) StartChallengeRequest ¶
func (c *ChallengingMonitor) StartChallengeRequest(ctx context.Context)
StartChallengeRequest starts to publish challenge request
func (*ChallengingMonitor) StopChallengeAnswer ¶
func (c *ChallengingMonitor) StopChallengeAnswer()
StopChallengeAnswer breaks loop
func (*ChallengingMonitor) StopChallengeRequest ¶
func (c *ChallengingMonitor) StopChallengeRequest()
StopChallengeRequest breaks loop
type NewChallengingMonitorOptions ¶
type NewChallengingMonitorOptions struct { PrivateKey ecdsa.PrivateKey Blockchain Blockchain ChallengeDB ChallengeDB SliceStorage SliceStorage ProveStorage ProveStorage }
type ProveStorage ¶
type ProveStorage interface {
Load(key string) (io.ReadCloser, error)
}
type SliceStorage ¶
type SliceStorage interface {
Load(key string, index string) (io.ReadCloser, error)
}
Click to show internal directories.
Click to hide internal directories.