sessions

package
v0.0.0-...-c0cc0bc Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0, MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RssInitStatus                 = "init"
	RssSubmitStatus               = "submit"
	RssGuardStatus                = "guard"
	RssGuardFileMetaSignedStatus  = "guard:file-meta-signed"
	RssGuardQuestionsSignedStatus = "guard:questions-signed"
	RssWaitUploadStatus           = "wait-upload"
	RssWaitUploadReqSignedStatus  = "wait-upload:req-signed"
	RssPayStatus                  = "pay"
	RssCompleteStatus             = "complete"
	RssErrorStatus                = "error"

	RssToSubmitEvent               = "to-submit-event"
	RssToGuardEvent                = "to-guard-event"
	RssToGuardFileMetaSignedEvent  = "to-guard:file-meta-signed-event"
	RssToGuardQuestionsSignedEvent = "to-guard:questions-signed-event"
	RssToWaitUploadEvent           = "to-wait-upload-event"
	RssToWaitUploadReqSignedEvent  = "to-wait-upload-signed-event"
	RssToPayEvent                  = "to-pay-event"
	RssToCompleteEvent             = "to-complete-event"
	RssToErrorEvent                = "to-error-event"

	RenterSessionPrefix            = "/btfs/%s/renter/sessions/"
	RenterSessionKey               = RenterSessionPrefix + "%s/"
	RenterSessionInMemKey          = RenterSessionKey
	RenterSessionStatusKey         = RenterSessionKey + "status"
	RenterSessionAdditionalInfoKey = RenterSessionKey + "additional-info"
	RenterSessionOfflineMetaKey    = RenterSessionKey + "offline-meta"
	RenterSessionOfflineSigningKey = RenterSessionKey + "offline-signing"
)

Variables

This section is empty.

Functions

func Batch

func Batch(d ds.Datastore, keys []string, vals []proto.Message) error

func DeleteShardsContracts

func DeleteShardsContracts(d datastore.Datastore, peerId string, role string) error

func Get

func Get(d ds.Datastore, key string, m proto.Message) error

func GetShardId

func GetShardId(ssId string, shardHash string, index int) (contractId string)

func List

func List(d ds.Datastore, prefix string, substrInKey ...string) ([][]byte, error)

func ListKeys

func ListKeys(d ds.Datastore, prefix string, substrInKey ...string) ([]string, error)

func ListShardsContracts

func ListShardsContracts(d datastore.Datastore, peerId string, role string) ([]*shardpb.SignedContracts, error)

func Remove

func Remove(d ds.Datastore, key string) error

func Save

func Save(d ds.Datastore, key string, val proto.Message) error

func SaveShardsContracts

func SaveShardsContracts(ds datastore.Datastore, scs []*shardpb.SignedContracts,
	gcs []*guardpb.Contract, peerID, role string) ([]*shardpb.SignedContracts, []string, error)

SaveShardsContracts persists updated guard contracts from upstream, if an existing entry is not available, then an empty signed escrow contract is inserted along with the new guard contract.

Types

type HostShard

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

func GetHostShard

func GetHostShard(ctxParams *uh.ContextParams, contractId string, inputPrice int64, amount int64, rate *big.Int) (*HostShard, error)

func (*HostShard) Complete

func (hs *HostShard) Complete() error

func (*HostShard) Contract

func (hs *HostShard) Contract(signedEscrowContract []byte, signedGuardContract *guardpb.Contract) error

func (*HostShard) GetInputAmount

func (hs *HostShard) GetInputAmount() int64

func (*HostShard) GetInputPrice

func (hs *HostShard) GetInputPrice() int64

func (*HostShard) GetInputRate

func (hs *HostShard) GetInputRate() *big.Int

func (*HostShard) IsContractStatus

func (hs *HostShard) IsContractStatus() bool

func (*HostShard) IsPayStatus

func (hs *HostShard) IsPayStatus() bool

func (*HostShard) ReceivePayCheque

func (hs *HostShard) ReceivePayCheque() error

type RenterSession

type RenterSession struct {
	PeerId      string
	SsId        string
	Hash        string
	ShardHashes []string

	CtxParams *uh.ContextParams
	Ctx       context.Context
	Cancel    context.CancelFunc
	Token     common.Address
	// contains filtered or unexported fields
}

func GetRenterSession

func GetRenterSession(ctxParams *uh.ContextParams, ssId string, hash string, shardHashes []string) (*RenterSession,
	error)

func GetRenterSessionWithToken

func GetRenterSessionWithToken(ctxParams *uh.ContextParams, ssId string, hash string, shardHashes []string, token common.Address) (*RenterSession,
	error)

func (*RenterSession) GetAdditionalInfo

func (rs *RenterSession) GetAdditionalInfo() (*renterpb.RenterSessionAdditionalInfo, error)

func (*RenterSession) GetCompleteShardsNum

func (rs *RenterSession) GetCompleteShardsNum() (int, int, error)

func (*RenterSession) OfflineMeta

func (rs *RenterSession) OfflineMeta() (*renterpb.OfflineMeta, error)

func (*RenterSession) OfflineSigning

func (rs *RenterSession) OfflineSigning() (*renterpb.OfflineSigning, error)

func (*RenterSession) SaveOfflineMeta

func (rs *RenterSession) SaveOfflineMeta(meta *renterpb.OfflineMeta) error

func (*RenterSession) SaveOfflineSigning

func (rs *RenterSession) SaveOfflineSigning(signingData *renterpb.OfflineSigning) error

func (*RenterSession) Status

func (*RenterSession) To

func (rs *RenterSession) To(event string, args ...interface{}) error

func (*RenterSession) UpdateAdditionalInfo

func (rs *RenterSession) UpdateAdditionalInfo(info string) error

type RenterSessionsCursor

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

func GetRenterSessionsCursor

func GetRenterSessionsCursor(ctxParam *uh.ContextParams) (*RenterSessionsCursor, error)

func (*RenterSessionsCursor) NextSession

func (r *RenterSessionsCursor) NextSession(status string) (*RenterSession, error)

type RenterShard

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

func GetRenterShard

func GetRenterShard(ctxParams *uh.ContextParams, ssId string, hash string, index int) (*RenterShard, error)

func (*RenterShard) Contract

func (rs *RenterShard) Contract(signedEscrowContract []byte, signedGuardContract *guardpb.Contract) error

func (*RenterShard) Contracts

func (rs *RenterShard) Contracts() (*shardpb.SignedContracts, error)

func (*RenterShard) GetAdditionalInfo

func (rs *RenterShard) GetAdditionalInfo() (*shardpb.AdditionalInfo, error)

func (*RenterShard) Status

func (rs *RenterShard) Status() (*shardpb.Status, error)

func (*RenterShard) UpdateAdditionalInfo

func (rs *RenterShard) UpdateAdditionalInfo(info string) error

Jump to

Keyboard shortcuts

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