directory

package
v0.4.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(parent *mux.Router, db *mongo.Database) error

Setup injects and initializes directory package

Types

type FarmAPI

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

FarmAPI holds farm releated handlers

func (*FarmAPI) Add

func (s *FarmAPI) Add(ctx context.Context, db *mongo.Database, farm directory.Farm) (schema.ID, error)

Add add farm to store

func (FarmAPI) Delete

func (s FarmAPI) Delete(ctx context.Context, db *mongo.Database, id int64) error

Delete deletes a farm by ID

func (*FarmAPI) GetByID

func (s *FarmAPI) GetByID(ctx context.Context, db *mongo.Database, id int64) (directory.Farm, error)

GetByID gets a farm by ID

func (*FarmAPI) GetByName

func (s *FarmAPI) GetByName(ctx context.Context, db *mongo.Database, name string) (directory.Farm, error)

GetByName gets a farm by name

func (*FarmAPI) List

func (s *FarmAPI) List(ctx context.Context, db *mongo.Database, filter directory.FarmFilter, opts ...*options.FindOptions) ([]directory.Farm, int64, error)

List farms TODO: add paging arguments

func (*FarmAPI) Update

func (s *FarmAPI) Update(ctx context.Context, db *mongo.Database, id schema.ID, farm directory.Farm) error

Update farm information

type GatewayAPI

type GatewayAPI struct{}

GatewayAPI holds api for gateways

func (*GatewayAPI) Add

Add a node to the store

func (*GatewayAPI) Count

func (s *GatewayAPI) Count(ctx context.Context, db *mongo.Database, filter directory.GatewayFilter) (int64, error)

Count counts the number of document in the collection

func (*GatewayAPI) Exists

func (s *GatewayAPI) Exists(ctx context.Context, db *mongo.Database, gwID string) (bool, error)

Exists tests if node exists

func (*GatewayAPI) Get

func (s *GatewayAPI) Get(ctx context.Context, db *mongo.Database, gwID string) (directory.Gateway, error)

Get a single gateway

func (*GatewayAPI) List

func (s *GatewayAPI) List(ctx context.Context, db *mongo.Database, q gatewayQuery, opts ...*options.FindOptions) ([]directory.Gateway, int64, error)

List all gateways

func (*GatewayAPI) Requires

func (s *GatewayAPI) Requires(key string, handler mw.Action) mw.Action

Requires is a wrapper that makes sure gateway with that key exists before running the handler

type NodeAPI

type NodeAPI struct{}

NodeAPI holds api for nodes

func (*NodeAPI) Add

func (s *NodeAPI) Add(ctx context.Context, db *mongo.Database, node directory.Node) (schema.ID, error)

Add a node to the store

func (*NodeAPI) Count

func (s *NodeAPI) Count(ctx context.Context, db *mongo.Database, filter directory.NodeFilter) (int64, error)

Count counts the number of document in the collection

func (*NodeAPI) Delete

func (s *NodeAPI) Delete(ctx context.Context, db *mongo.Database, nodeID string) error

Delete a single node

func (*NodeAPI) Exists

func (s *NodeAPI) Exists(ctx context.Context, db *mongo.Database, nodeID string) (bool, error)

Exists tests if node exists

func (*NodeAPI) Get

func (s *NodeAPI) Get(ctx context.Context, db *mongo.Database, nodeID string, includeProofs bool) (directory.Node, error)

Get a single node

func (*NodeAPI) List

func (s *NodeAPI) List(ctx context.Context, db *mongo.Database, q nodeQuery, opts ...*options.FindOptions) ([]directory.Node, int64, error)

List farms TODO: add paging arguments

func (*NodeAPI) Requires

func (s *NodeAPI) Requires(key string, handler mw.Action) mw.Action

Requires is a wrapper that makes sure node with that case exists before running the handler

func (*NodeAPI) SetInterfaces

func (s *NodeAPI) SetInterfaces(ctx context.Context, db *mongo.Database, nodeID string, ifaces []generated.Iface) error

SetInterfaces updates node interfaces

func (*NodeAPI) SetPublicConfig

func (s *NodeAPI) SetPublicConfig(ctx context.Context, db *mongo.Database, nodeID string, cfg generated.PublicIface) error

SetPublicConfig sets node public config

func (*NodeAPI) SetWGPorts

func (s *NodeAPI) SetWGPorts(ctx context.Context, db *mongo.Database, nodeID string, ports []uint) error

SetWGPorts sets node gateway ports

func (*NodeAPI) StoreProof

func (s *NodeAPI) StoreProof(ctx context.Context, db *mongo.Database, nodeID string, dmi dmi.DMI, disks capacity.Disks, hypervisor []string) error

StoreProof stores node hardware proof

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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