disk

package
v0.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package disk implements an ipfs-cluster informer which can provide different disk-related metrics from the IPFS daemon as an api.Metric.

Index

Constants

View Source
const (
	DefaultMetricTTL  = 30 * time.Second
	DefaultMetricType = MetricFreeSpace
)

Default values for disk Config

View Source
const (
	// MetricFreeSpace provides the available space reported by IPFS
	MetricFreeSpace = iota
	// MetricRepoSize provides the used space reported by IPFS
	MetricRepoSize
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.0

type Config struct {
	config.Saver

	MetricTTL time.Duration
	Type      MetricType
}

Config is used to initialize an Informer and customize the type and parameters of the metric it produces.

func (*Config) ConfigKey added in v0.2.0

func (cfg *Config) ConfigKey() string

ConfigKey returns a human-friendly identifier for this type of Metric.

func (*Config) Default added in v0.2.0

func (cfg *Config) Default() error

Default initializes this Config with sensible values.

func (*Config) LoadJSON added in v0.2.0

func (cfg *Config) LoadJSON(raw []byte) error

LoadJSON reads the fields of this Config from a JSON byteslice as generated by ToJSON.

func (*Config) ToJSON added in v0.2.0

func (cfg *Config) ToJSON() (raw []byte, err error)

ToJSON generates a JSON-formatted human-friendly representation of this Config.

func (*Config) Validate added in v0.2.0

func (cfg *Config) Validate() error

Validate checks that the fields of this Config have working values, at least in appearance.

type Informer

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

Informer is a simple object to implement the ipfscluster.Informer and Component interfaces.

func NewInformer

func NewInformer(cfg *Config) (*Informer, error)

NewInformer returns an initialized informer using the given InformerConfig.

func (*Informer) GetMetric

func (disk *Informer) GetMetric() api.Metric

GetMetric returns the metric obtained by this Informer.

func (*Informer) Name

func (disk *Informer) Name() string

Name returns the user-facing name of this informer.

func (*Informer) SetClient

func (disk *Informer) SetClient(c *rpc.Client)

SetClient provides us with an rpc.Client which allows contacting other components in the cluster.

func (*Informer) Shutdown

func (disk *Informer) Shutdown() error

Shutdown is called on cluster shutdown. We just invalidate any metrics from this point.

type MetricType added in v0.2.0

type MetricType int

MetricType identifies the type of metric to fetch from the IPFS daemon.

func (MetricType) String added in v0.2.0

func (t MetricType) String() string

String returns a string representation for MetricType.

Jump to

Keyboard shortcuts

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