Documentation ¶
Index ¶
- func Setup(parent *mux.Router, db *mongo.Database) error
- type FarmAPI
- func (s *FarmAPI) Add(ctx context.Context, db *mongo.Database, farm directory.Farm) (schema.ID, error)
- func (s FarmAPI) Delete(ctx context.Context, db *mongo.Database, id int64) error
- func (s *FarmAPI) GetByID(ctx context.Context, db *mongo.Database, id int64) (directory.Farm, error)
- func (s *FarmAPI) GetByName(ctx context.Context, db *mongo.Database, name string) (directory.Farm, error)
- func (s *FarmAPI) List(ctx context.Context, db *mongo.Database, filter directory.FarmFilter, ...) ([]directory.Farm, int64, error)
- type NodeAPI
- func (s *NodeAPI) Add(ctx context.Context, db *mongo.Database, node directory.Node) (schema.ID, error)
- func (s *NodeAPI) Count(ctx context.Context, db *mongo.Database, filter directory.NodeFilter) (int64, error)
- func (s *NodeAPI) Exists(ctx context.Context, db *mongo.Database, nodeID string) (bool, error)
- func (s *NodeAPI) Get(ctx context.Context, db *mongo.Database, nodeID string, includeProofs bool) (directory.Node, error)
- func (s *NodeAPI) List(ctx context.Context, db *mongo.Database, q nodeQuery, ...) ([]directory.Node, int64, error)
- func (s *NodeAPI) Requires(key string, handler mw.Action) mw.Action
- func (s *NodeAPI) SetInterfaces(ctx context.Context, db *mongo.Database, nodeID string, ...) error
- func (s *NodeAPI) SetPublicConfig(ctx context.Context, db *mongo.Database, nodeID string, ...) error
- func (s *NodeAPI) SetWGPorts(ctx context.Context, db *mongo.Database, nodeID string, ports []uint) error
- func (s *NodeAPI) StoreProof(ctx context.Context, db *mongo.Database, nodeID string, dmi dmi.DMI, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) GetByID ¶
func (s *FarmAPI) GetByID(ctx context.Context, db *mongo.Database, id int64) (directory.Farm, error)
GetByID gets a farm by ID
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) 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 ¶
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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.