Documentation ¶
Index ¶
- func LoadFarmMiddleware(next http.Handler) http.Handler
- 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) DeleteFarmThreebotCustomPrice(ctx context.Context, db *mongo.Database, farmID, threebotID int64) error
- func (s *FarmAPI) FarmThreebotPriceCreateOrUpdate(ctx context.Context, db *mongo.Database, ...) 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) GetFarmCustomPriceForThreebot(ctx context.Context, db *mongo.Database, farmID, threebotID int64) (directory.FarmThreebotPrice, error)
- func (s *FarmAPI) GetFarmCustomPrices(ctx context.Context, db *mongo.Database, farmID int64) ([]directory.FarmThreebotPrice, int64, error)
- func (s *FarmAPI) List(ctx context.Context, db *mongo.Database, filter directory.FarmFilter, ...) ([]directory.Farm, int64, error)
- func (s *FarmAPI) PushIP(ctx context.Context, db *mongo.Database, id schema.ID, ip schema.IPCidr, ...) error
- func (s *FarmAPI) RemoveIP(ctx context.Context, db *mongo.Database, id schema.ID, ip schema.IPCidr) error
- func (s *FarmAPI) Update(ctx context.Context, db *mongo.Database, id schema.ID, farm directory.Farm) error
- type GatewayAPI
- func (s *GatewayAPI) Add(ctx context.Context, db *mongo.Database, gw directory.Gateway) (schema.ID, error)
- func (s *GatewayAPI) Count(ctx context.Context, db *mongo.Database, filter directory.GatewayFilter) (int64, error)
- func (s *GatewayAPI) Exists(ctx context.Context, db *mongo.Database, gwID string) (bool, error)
- func (s *GatewayAPI) Get(ctx context.Context, db *mongo.Database, gwID string) (directory.Gateway, error)
- func (s *GatewayAPI) List(ctx context.Context, db *mongo.Database, q gatewayQuery, ...) ([]directory.Gateway, int64, error)
- func (s *GatewayAPI) Requires(key string, handler mw.Action) mw.Action
- 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) Delete(ctx context.Context, db *mongo.Database, nodeID string) 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 ¶
func LoadFarmMiddleware ¶ added in v0.4.8
LoadFarmMiddleware verifies if the farmer who wants to update information about it's farm is indeed that farmer
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) DeleteFarmThreebotCustomPrice ¶ added in v0.5.0
func (s *FarmAPI) DeleteFarmThreebotCustomPrice(ctx context.Context, db *mongo.Database, farmID, threebotID int64) error
DeleteFarmThreebotCustomPrice Delete FarmThreebotCustomPrice deletes a deal between farm and a threebot
func (*FarmAPI) FarmThreebotPriceCreateOrUpdate ¶ added in v0.5.0
func (s *FarmAPI) FarmThreebotPriceCreateOrUpdate(ctx context.Context, db *mongo.Database, farmThreebotPrice directory.FarmThreebotPrice) error
FarmThreebotPriceCreateOrUpdate creates or updates a new farm deal with a threebot
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) GetFarmCustomPriceForThreebot ¶ added in v0.5.0
func (s *FarmAPI) GetFarmCustomPriceForThreebot(ctx context.Context, db *mongo.Database, farmID, threebotID int64) (directory.FarmThreebotPrice, error)
GetFarmCustomPriceForThreebot gets a farm deal with a specific threebot
func (*FarmAPI) GetFarmCustomPrices ¶ added in v0.5.0
func (s *FarmAPI) GetFarmCustomPrices(ctx context.Context, db *mongo.Database, farmID int64) ([]directory.FarmThreebotPrice, int64, error)
GetFarmCustomPrices gets the farm deals
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) PushIP ¶ added in v0.4.8
func (s *FarmAPI) PushIP(ctx context.Context, db *mongo.Database, id schema.ID, ip schema.IPCidr, gw net.IP) error
PushIP push ip
type GatewayAPI ¶
type GatewayAPI struct{}
GatewayAPI holds api for gateways
func (*GatewayAPI) Add ¶
func (s *GatewayAPI) Add(ctx context.Context, db *mongo.Database, gw directory.Gateway) (schema.ID, error)
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) Get ¶
func (s *GatewayAPI) Get(ctx context.Context, db *mongo.Database, gwID string) (directory.Gateway, error)
Get a single gateway
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