regclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package regclient defines a client for interacting with a registry server

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoRegistry indicates that no registry has been specified
	// all client methods MUST return ErrNoRegistry for all method calls
	// when config.Registry.Location is an empty string
	ErrNoRegistry = errors.New("registry: no registry specified")
	// ErrNoConnection indicates no path to the registry can be found
	ErrNoConnection = errors.New("registry: no connection")
	// ErrNotRegistered indicates this client is not registered
	ErrNotRegistered = errors.New("registry: not registered")

	// HTTPClient is hoisted here in case you'd like to use a different client instance
	// by default we just use http.DefaultClient
	HTTPClient = http.DefaultClient
)

Functions

This section is empty.

Types

type Client

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

Client wraps a registry configuration with methods for interacting with the configured registry

func NewClient

func NewClient(cfg *Config) *Client

NewClient creates a registry from a provided Registry configuration

func (Client) DeleteDataset

func (c Client) DeleteDataset(peername, dsname string, ds *dataset.Dataset, pubKey crypto.PubKey) error

DeleteDataset removes a dataset from the registry

func (Client) DeleteProfile

func (c Client) DeleteProfile(handle string, privKey crypto.PrivKey) error

DeleteProfile removes a profile from the registry

func (*Client) DsyncFetch

func (c *Client) DsyncFetch(ctx context.Context, path string, ng ipld.NodeGetter, bapi coreiface.BlockAPI) error

DsyncFetch fetches an entire DAG designated by root path

func (*Client) DsyncSend

func (c *Client) DsyncSend(ctx context.Context, ng ipld.NodeGetter, mfst *dag.Manifest) error

DsyncSend sents an entire Manifest

func (Client) GetDataset

func (c Client) GetDataset(peername, dsname, profileID, hash string) (*registry.Dataset, error)

GetDataset fetches a dataset from a registry

func (Client) GetProfile

func (c Client) GetProfile(p *registry.Profile) error

GetProfile fills in missing fields in p with registry data

func (Client) GetReputation

func (c Client) GetReputation(id string) (*registry.ReputationResponse, error)

GetReputation gets the reputation of a profile using the ProfileID

func (Client) ListDatasets

func (c Client) ListDatasets(limit, offset int) ([]*registry.Dataset, error)

ListDatasets returns a list of the datasets in the registry, using limit and offset

func (Client) Pin

func (c Client) Pin(path string, privKey crypto.PrivKey, addrs []string) error

Pin requests a dataset be replicated on the registry

func (Client) PutDataset

func (c Client) PutDataset(peername, dsname string, ds *dataset.Dataset, pubKey crypto.PubKey) error

PutDataset adds a dataset to a registry

func (Client) PutProfile

func (c Client) PutProfile(handle string, privKey crypto.PrivKey) error

PutProfile adds a profile to the registry

func (Client) Search

func (c Client) Search(p *SearchParams) ([]*registry.Result, error)

Search makes a registry search request

func (Client) Status

func (c Client) Status(path string) (s pinset.PinStatus, err error)

Status checks if a given path is pinned to this registry

func (Client) Unpin

func (c Client) Unpin(path string, privKey crypto.PrivKey) error

Unpin requests a dataset not be replicated to the registry

type Config

type Config struct {
	// Location is the URL base to call to
	Location string
}

Config encapsulates options for working with a registry

type SearchFilter

type SearchFilter struct {
	// Type denotes the ype of search filter
	Type string
	// Relation indicates the relation between the key and value
	// supported options include ["eq"|"neq"|"gt"|"gte"|"lt"|"lte"]
	Relation string
	// Key corresponds to the name of the index mapping that we wish to
	// apply the filter to
	Key string
	// Value is the predicate of the subject-relation-predicate triple
	// eg. [key=timestamp] [gte] [value=[today]]
	Value interface{}
}

SearchFilter stores various types of filters that may be applied to a search

type SearchParams

type SearchParams struct {
	QueryString string
	Filters     []SearchFilter
	Limit       int
	Offset      int
}

SearchParams contains the parameters that are passed to a Client.Search method

Jump to

Keyboard shortcuts

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