Documentation ¶
Overview ¶
Package gedis implements a client for Gedis (https://github.com/threefoldtech/digitalmeX/tree/master/docs/Gedis)
Index ¶
- Variables
- func ReservationToSchemaType(r *provision.Reservation) (types.TfgridReservation1, error)
- type Args
- type Error
- type Gedis
- func (g *Gedis) Close() error
- func (g *Gedis) Delete(id string) error
- func (g *Gedis) Deleted(nodeID, id string) error
- func (g *Gedis) Feedback(nodeID string, r *provision.Result) error
- func (g *Gedis) Get(id string) (*provision.Reservation, error)
- func (g *Gedis) GetFarm(farm pkg.Identifier) (*network.Farm, error)
- func (g *Gedis) GetNode(nodeID pkg.Identifier) (*types.Node, error)
- func (g *Gedis) GetPubIface(node pkg.Identifier) (*types.PubIface, error)
- func (g *Gedis) ListFarm(country string, city string) ([]network.Farm, error)
- func (g *Gedis) ListNode(farmID pkg.FarmID, country string, city string) ([]types.Node, error)
- func (g *Gedis) Ping() (string, error)
- func (g *Gedis) Poll(nodeID pkg.Identifier, from uint64) ([]*provision.Reservation, error)
- func (g *Gedis) PublishInterfaces(local pkg.Identifier, ifaces []types.IfaceInfo) error
- func (g *Gedis) PublishWGPort(node pkg.Identifier, ports []uint) error
- func (g *Gedis) RegisterFarm(tid uint64, name string, email string, wallet []string) (pkg.FarmID, error)
- func (g *Gedis) RegisterNode(nodeID pkg.Identifier, farmID pkg.FarmID, version string, ...) (string, error)
- func (g *Gedis) Reserve(r *provision.Reservation) (string, error)
- func (g *Gedis) Send(actor, method string, args Args) (interface{}, error)
- func (g *Gedis) SendHardwareProof(node pkg.Identifier, dmi interface{}, disks interface{}, hypervisor []string) error
- func (g *Gedis) SetPublicIface(node pkg.Identifier, pub *types.PubIface) error
- func (g *Gedis) UpdateReservedNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error
- func (g *Gedis) UpdateReservedResources(nodeID string, c provision.Counters) error
- func (g *Gedis) UpdateTotalNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error
- func (g *Gedis) UpdateUsedNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error
- func (g *Gedis) UptimeUpdate(nodeID pkg.Identifier, uptime uint64) error
- type Pool
Constants ¶
This section is empty.
Variables ¶
var ( // Bytes is a helper that converts a command reply to a slice of bytes. If err // is not equal to nil, then Bytes returns nil, err. Otherwise Bytes converts // the reply to a slice of bytes as follows: // // Reply type Result // bulk string reply, nil // simple string []byte(reply), nil // nil nil, ErrNil // other nil, error Bytes = redis.Bytes // Bool is a helper that converts a command reply to a boolean. If err is not // equal to nil, then Bool returns false, err. Otherwise Bool converts the // reply to boolean as follows: // // Reply type Result // integer value != 0, nil // bulk string strconv.ParseBool(reply) // nil false, ErrNil // other false, error Bool = redis.Bool )
Functions ¶
func ReservationToSchemaType ¶
func ReservationToSchemaType(r *provision.Reservation) (types.TfgridReservation1, error)
ReservationToSchemaType creates a TfgridReservation1 from zos provision types
Types ¶
type Error ¶
type Error struct { Message string `json:"message,omitempty"` Level uint `json:"level,omitempty"` Context string `json:"context,omitempty"` Category string `json:"cat,omitempty"` }
Error is an error returned by a gedis server
type Gedis ¶
type Gedis struct {
// contains filtered or unexported fields
}
Gedis struct represent a client to a gedis server
func (*Gedis) Close ¶
Close closes all connection to the gedis server and stops the close the connection pool
func (*Gedis) Get ¶
func (g *Gedis) Get(id string) (*provision.Reservation, error)
Get implements provision.ReservationGetter
func (*Gedis) GetPubIface ¶
GetPubIface gets public config of a node
func (*Gedis) Poll ¶
func (g *Gedis) Poll(nodeID pkg.Identifier, from uint64) ([]*provision.Reservation, error)
Poll retrieves reservations from BCDB. from acts like a cursor, first call should use 0 to retrieve everything. Next calls should use the last (MAX) ID of the previous poll. Note that from is a reservation ID not a workload ID. so user the Reservation.SplitID() method to get the reservation part.
func (*Gedis) PublishInterfaces ¶
PublishInterfaces implements network.TNoDB interface
func (*Gedis) PublishWGPort ¶
func (g *Gedis) PublishWGPort(node pkg.Identifier, ports []uint) error
PublishWGPort implements network.TNoDB interface
func (*Gedis) RegisterFarm ¶
func (g *Gedis) RegisterFarm(tid uint64, name string, email string, wallet []string) (pkg.FarmID, error)
RegisterFarm implements pkg.IdentityManager interface
func (*Gedis) RegisterNode ¶
func (g *Gedis) RegisterNode(nodeID pkg.Identifier, farmID pkg.FarmID, version string, location geoip.Location) (string, error)
RegisterNode implements pkg.IdentityManager interface
func (*Gedis) Reserve ¶
func (g *Gedis) Reserve(r *provision.Reservation) (string, error)
Reserve provision.Reserver
func (*Gedis) Send ¶
Send send a command and read response. args, is a map with argument name, and value as defined by the actor schema. Usually you need to process the returned value through `Bytes`, `Bool` or other wrappers based on the expected return value
func (*Gedis) SendHardwareProof ¶
func (g *Gedis) SendHardwareProof(node pkg.Identifier, dmi interface{}, disks interface{}, hypervisor []string) error
SendHardwareProof sends a dump of hardware and disks to BCDB
func (*Gedis) SetPublicIface ¶
SetPublicIface implements network.TNoDB interface
func (*Gedis) UpdateReservedNodeCapacity ¶
func (g *Gedis) UpdateReservedNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error
UpdateReservedNodeCapacity implements pkg.IdentityManager interface
func (*Gedis) UpdateReservedResources ¶
UpdateReservedResources sends current reserved resources
func (*Gedis) UpdateTotalNodeCapacity ¶
func (g *Gedis) UpdateTotalNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error
UpdateTotalNodeCapacity implements pkg.IdentityManager interface
func (*Gedis) UpdateUsedNodeCapacity ¶
func (g *Gedis) UpdateUsedNodeCapacity(node pkg.Identifier, mru, cru, hru, sru uint64) error
UpdateUsedNodeCapacity implements pkg.IdentityManager interface
func (*Gedis) UptimeUpdate ¶
func (g *Gedis) UptimeUpdate(nodeID pkg.Identifier, uptime uint64) error
UptimeUpdate send the uptime of the node to BCDB