directory

package
v0.2.2-rc8-a Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

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{}

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 TODO: support update farm information ?

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

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) 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