contracts

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: Apache-2.0, MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StorageContractsCmd = &cmds.Command{
	Helptext: cmds.HelpText{
		Tagline: "Get node storage contracts info.",
		ShortDescription: `
This command get node storage contracts info respect to different roles.`,
	},
	Subcommands: map[string]*cmds.Command{
		"sync": storageContractsSyncCmd,
		"stat": storageContractsStatCmd,
		"list": storageContractsListCmd,
	},
}

Storage Contracts

Includes sub-commands: sync, stat, list

Functions

func GetUpdatedGuardContractsForHost

func GetUpdatedGuardContractsForHost(ctx context.Context, n *core.IpfsNode,
	lastUpdatedTime *time.Time) ([]*guardpb.Contract, error)

GetUpdatedGuardContractsForHost retrieves updated guard contracts from remote based on latest timestamp and returns the list updated

func GetUpdatedGuardContractsForRenter

func GetUpdatedGuardContractsForRenter(ctx context.Context, n *core.IpfsNode,
	lastUpdatedTime *time.Time) ([]*guardpb.Contract, error)

GetUpdatedGuardContractsForRenter retrieves updated guard contracts from remote based on latest timestamp and returns the list updated

func ListContracts

func ListContracts(d datastore.Datastore, peerId, role string) ([]*nodepb.Contracts_Contract, error)

func ListHostContracts

func ListHostContracts(ctx context.Context, cfg *config.Config,
	listReq *guardpb.ListHostContractsRequest) ([]*guardpb.Contract, bool, error)

ListHostContracts opens a grpc connection, sends the host contract list request and closes (short) connection

func Save

func Save(d datastore.Datastore, cs []*nodepb.Contracts_Contract, role string) error

func SyncContracts

func SyncContracts(ctx context.Context, n *core.IpfsNode, req *cmds.Request, env cmds.Environment,
	role string) error

SyncContracts does the following: 1) Obtain latest guard contract updates and saves into cache 2) Obtain latest payout status updates and saves into cache

Types

type ByTime

type ByTime []*nodepb.Contracts_Contract

func (ByTime) Len

func (a ByTime) Len() int

func (ByTime) Less

func (a ByTime) Less(i, j int) bool

func (ByTime) Swap

func (a ByTime) Swap(i, j int)

Jump to

Keyboard shortcuts

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