Documentation ¶
Overview ¶
Package gateway contains the HTTP Server and the utility functions for the REAR Gateway
Index ¶
- Constants
- type Gateway
- func (g *Gateway) CacheRefresher(interval time.Duration) func(ctx context.Context) error
- func (g *Gateway) DiscoverFlavours(ctx context.Context, selector *nodecorev1alpha1.FlavourSelector) ([]*nodecorev1alpha1.Flavour, 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) PurchaseFlavour(ctx context.Context, transactionID string, ...) (*models.ResponsePurchase, error)
- func (g *Gateway) RegisterNodeIdentity(nodeIdentity *nodecorev1alpha1.NodeIdentity)
- func (g *Gateway) ReserveFlavour(ctx context.Context, reservation *reservationv1alpha1.Reservation, ...) (*models.Transaction, error)
- func (g *Gateway) SearchTransaction(buyerID, flavourID string) (*models.Transaction, bool)
- func (g *Gateway) Start(ctx context.Context) error
Constants ¶
const ( // ListFlavoursPath is the path to get the list of flavours. ListFlavoursPath = "/api/listflavours" // ListFlavourByIDPath is the path to get a flavour by ID. ListFlavourByIDPath = "/api/listflavours/" // ReserveFlavourPath is the path to reserve a flavour. ReserveFlavourPath = "/api/reserveflavour/" // PurchaseFlavourPath is the path to purchase a flavour. PurchaseFlavourPath = "/api/purchaseflavour/" // ListFlavoursBySelectorPath is the path to get the list of flavours by selector. ListFlavoursBySelectorPath = "/api/listflavours/selector" )
Variables ¶
This section is empty.
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) DiscoverFlavours ¶
func (g *Gateway) DiscoverFlavours(ctx context.Context, selector *nodecorev1alpha1.FlavourSelector) ([]*nodecorev1alpha1.Flavour, error)
DiscoverFlavours is a function that returns an array of Flavour 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) PurchaseFlavour ¶
func (g *Gateway) PurchaseFlavour(ctx context.Context, transactionID string, seller nodecorev1alpha1.NodeIdentity) (*models.ResponsePurchase, error)
PurchaseFlavour purchases a flavour with the given flavourID.
func (*Gateway) RegisterNodeIdentity ¶
func (g *Gateway) RegisterNodeIdentity(nodeIdentity *nodecorev1alpha1.NodeIdentity)
RegisterNodeIdentity registers the FLUIDOS Node identity into the Gateway.
func (*Gateway) ReserveFlavour ¶
func (g *Gateway) ReserveFlavour(ctx context.Context, reservation *reservationv1alpha1.Reservation, flavourID string) (*models.Transaction, error)
ReserveFlavour reserves a flavour with the given flavourID.
func (*Gateway) SearchTransaction ¶
func (g *Gateway) SearchTransaction(buyerID, flavourID string) (*models.Transaction, bool)
SearchTransaction returns a transaction from the transactions map.