Documentation ¶
Overview ¶
Package gateway contains the HTTP Server and the utility functions for the REAR Gateway
Index ¶
- Constants
- Variables
- type Gateway
- func (g *Gateway) CacheRefresher(interval time.Duration) func(ctx context.Context) error
- func (g *Gateway) DiscoverFlavors(ctx context.Context, selector *nodecorev1alpha1.Selector) ([]*nodecorev1alpha1.Flavor, error)
- func (g *Gateway) GetTransaction(transactionID string) (models.Transaction, error)
- func (g *Gateway) LiqoChecker(interval time.Duration) func(ctx context.Context) error
- func (g *Gateway) PurchaseFlavor(ctx context.Context, transactionID string, ...) (*models.Contract, error)
- func (g *Gateway) RegisterNodeIdentity(nodeIdentity *nodecorev1alpha1.NodeIdentity)
- func (g *Gateway) ReserveFlavor(ctx context.Context, reservation *reservationv1alpha1.Reservation, ...) (*models.Transaction, error)
- func (g *Gateway) SearchTransaction(buyerID, flavorID string) (*models.Transaction, bool)
- func (g *Gateway) Start(ctx context.Context) error
Constants ¶
const ( // ListFlavorsPath is the path to get the list of flavors. ListFlavorsPath = "/api/listflavors" // ListFlavorByIDPath is the path to get a flavor by ID. ListFlavorByIDPath = "/api/listflavors/" // ReserveFlavorPath is the path to reserve a flavor. ReserveFlavorPath = "/api/reserveflavor/" // PurchaseFlavorPath is the path to purchase a flavor. PurchaseFlavorPath = "/api/purchaseflavor/" // ListFlavorsBySelectorPath is the path to get the list of flavors by selector. ListFlavorsBySelectorPath = "/api/listflavors/selector" )
Variables ¶
var Routes = struct { // Flavors is the route to get all the flavors. Flavors string // K8SliceFlavors is the route to get all the K8Slice flavors. K8SliceFlavors string // VMFlavors is the route to get all the VM flavors. VMFlavors string // ServiceFlavors is the route to get all the service flavors. ServiceFlavors string // SensorsFlavors is the route to get all the sensors flavors. SensorsFlavors string // Reserve is the route to reserve a flavor. Reserve string // Purchase is the route to purchase a flavor. Purchase string }{ Flavors: "/api/v2/flavors", K8SliceFlavors: "/api/v2/flavors/k8slice", VMFlavors: "/api/v2/flavors/vm", ServiceFlavors: "/api/v2/flavors/service", SensorsFlavors: "/api/v2/flavors/sensors", Reserve: "/api/v2/reservations", Purchase: "/api/v2/transactions/{transactionID}/purchase", }
Routes defines the routes for the rear controller.
Functions ¶
This section is empty.
Types ¶
type Gateway ¶
type Gateway struct { // NodeIdentity is the identity of the FLUIDOS Node ID *nodecorev1alpha1.NodeIdentity // Transactions is a map of Transaction Transactions map[string]*models.Transaction // Readyness of the Gateway. It is set when liqo is installed LiqoReady bool // The Liqo ClusterID ClusterID string // contains filtered or unexported fields }
Gateway is the object that contains all the logical data stractures of the REAR Gateway.
func NewGateway ¶
NewGateway creates a new Gateway object.
func (*Gateway) CacheRefresher ¶
CacheRefresher is a function that periodically checks the cache and removes expired transactions.
func (*Gateway) DiscoverFlavors ¶ added in v0.1.0
func (g *Gateway) DiscoverFlavors(ctx context.Context, selector *nodecorev1alpha1.Selector) ([]*nodecorev1alpha1.Flavor, error)
DiscoverFlavors is a function that returns an array of Flavor that fit the Selector by performing a get request to an http server.
func (*Gateway) GetTransaction ¶
func (g *Gateway) GetTransaction(transactionID string) (models.Transaction, error)
GetTransaction returns a transaction from the transactions map.
func (*Gateway) LiqoChecker ¶
LiqoChecker is a function that periodically checks if Liqo is ready.
func (*Gateway) PurchaseFlavor ¶ added in v0.1.0
func (g *Gateway) PurchaseFlavor(ctx context.Context, transactionID string, seller nodecorev1alpha1.NodeIdentity, buyerLiqoCredentials *models.LiqoCredentials) (*models.Contract, error)
PurchaseFlavor purchases a flavor with the given flavorID.
func (*Gateway) RegisterNodeIdentity ¶
func (g *Gateway) RegisterNodeIdentity(nodeIdentity *nodecorev1alpha1.NodeIdentity)
RegisterNodeIdentity registers the FLUIDOS Node identity into the Gateway.
func (*Gateway) ReserveFlavor ¶ added in v0.1.0
func (g *Gateway) ReserveFlavor(ctx context.Context, reservation *reservationv1alpha1.Reservation, flavorID string) (*models.Transaction, error)
ReserveFlavor reserves a flavor with the given flavorID.
func (*Gateway) SearchTransaction ¶
func (g *Gateway) SearchTransaction(buyerID, flavorID string) (*models.Transaction, bool)
SearchTransaction returns a transaction from the transactions map.