stats

package
v0.0.0-...-9fdd194 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostStatStorePrefix = "/host_stats/" // from btfs-hub
)

Variables

View Source
var StorageStatsCmd = &cmds.Command{
	Helptext: cmds.HelpText{
		Tagline: "Get node storage stats.",
		ShortDescription: `
This command get node storage stats in the network.`,
	},
	Subcommands: map[string]*cmds.Command{
		"sync": storageStatsSyncCmd,
		"info": storageStatsInfoCmd,
		"list": storageStatsListCmd,
	},
}

Storage Stats

Includes sub-commands: info, sync

Functions

func GetHostStatStorageKey

func GetHostStatStorageKey(pid string) ds.Key

func GetHostStatStorageKeyWithTimestamp

func GetHostStatStorageKeyWithTimestamp(pid string) ds.Key

func GetHostStatsFromDatastore

func GetHostStatsFromDatastore(ctx context.Context, node *core.IpfsNode, nodeId string) (*nodepb.StorageStat_Host, error)

GetHostStatsFromDatastore retrieves host storage stats based on node id

func GetNowStats

func GetNowStats(ctx context.Context, cfg *config.Config, node *core.IpfsNode, env cmds.Environment, V2 bool) (hs *nodepb.StorageStat_Host, err error)

func SaveHostStatsIntoDatastore

func SaveHostStatsIntoDatastore(ctx context.Context, node *core.IpfsNode, nodeId string,
	stats *nodepb.StorageStat_Host) error

SaveHostStatsIntoDatastore overwrites host storage stats based on node id

func SyncStats

func SyncStats(ctx context.Context, cfg *config.Config, node *core.IpfsNode, env cmds.Environment, v2 bool) error

Types

type Stat_HostWithTimeStamp

type Stat_HostWithTimeStamp struct {
	Stat      nodepb.StorageStat_Host `json:"stat"`
	Timestamp int64                   `json:"timestamp"`
}

func ListHostStatsFromDatastore

func ListHostStatsFromDatastore(ctx context.Context, node *core.IpfsNode, nodeId string, from int64, to int64) ([]*Stat_HostWithTimeStamp, error)

ListHostStatsFromDatastore retrieves host storage stats based on node id

Jump to

Keyboard shortcuts

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