escrow

package
v0.2.4-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Escrow

type Escrow interface {
	Run(ctx context.Context) error
	RegisterReservation(reservation workloads.Reservation) (types.CustomerEscrowInformation, error)
	ReservationDeployed(reservationID schema.ID)
	ReservationCanceled(reservationID schema.ID)
}

Escrow are responsible for the payment flow of a reservation

type FarmAPI

type FarmAPI interface {
	// GetByID get a farm from the database using its ID
	GetByID(ctx context.Context, db *mongo.Database, id int64) (directorytypes.Farm, error)
}

FarmAPI operations on farm database

type Free

type Free struct {
	// contains filtered or unexported fields
}

Free implements the Escrow interface in a way that makes all reservation free

func NewFree

func NewFree(db *mongo.Database) *Free

NewFree creates a new EscrowFree object

func (*Free) RegisterReservation

func (e *Free) RegisterReservation(reservation workloads.Reservation) (detail types.CustomerEscrowInformation, err error)

RegisterReservation implements the escrow interface

func (*Free) ReservationCanceled

func (e *Free) ReservationCanceled(reservationID schema.ID)

ReservationCanceled implements the escrow interface

func (*Free) ReservationDeployed

func (e *Free) ReservationDeployed(reservationID schema.ID)

ReservationDeployed implements the escrow interface

func (*Free) Run

func (e *Free) Run(ctx context.Context) error

Run implements the escrow interface

type NodeAPI

type NodeAPI interface {
	// Get a node from the database using its ID
	Get(ctx context.Context, db *mongo.Database, id string, proofs bool) (directorytypes.Node, error)
}

NodeAPI operations on node database

type Stellar

type Stellar struct {
	// contains filtered or unexported fields
}

Stellar service manages a dedicate wallet for payments for reservations.

func NewStellar

func NewStellar(wallet *stellar.Wallet, db *mongo.Database) *Stellar

NewStellar creates a new escrow object and fetches all addresses for the escrow wallet

func (*Stellar) RegisterReservation

func (e *Stellar) RegisterReservation(reservation workloads.Reservation) (types.CustomerEscrowInformation, error)

RegisterReservation registers a workload reservation

func (*Stellar) ReservationCanceled

func (e *Stellar) ReservationCanceled(reservationID schema.ID)

ReservationCanceled informs the escrow of a canceled reservation so it can refund the user

func (*Stellar) ReservationDeployed

func (e *Stellar) ReservationDeployed(reservationID schema.ID)

ReservationDeployed informs the escrow that a reservation has been successfully deployed, so the escrow can release the funds to the farmer (and refund any excess)

func (*Stellar) Run

func (e *Stellar) Run(ctx context.Context) error

Run the escrow until the context is done

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL