capi

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBiddersHandler

func GetBiddersHandler(res http.ResponseWriter, req *http.Request)

GetBiddersHandler will return a json response. FIXME this is not yet implemented since we dont have the info yet.

func GetEventQueueStatusHandler

func GetEventQueueStatusHandler(res http.ResponseWriter, req *http.Request)

GetEventQueueStatusHandler will return EventQueueJSON json.

func GetP2PCountHandler

func GetP2PCountHandler(res http.ResponseWriter, req *http.Request)

GetP2PCountHandler will return the current peer count.

func GetP2PLogsHandler

func GetP2PLogsHandler(res http.ResponseWriter, req *http.Request)

GetP2PLogsHandler will return PeerJSON json.

func GetProvisionersHandler

func GetProvisionersHandler(res http.ResponseWriter, req *http.Request)

GetProvisionersHandler will return Provisioners json.

func GetRoundInfoHandler

func GetRoundInfoHandler(res http.ResponseWriter, req *http.Request)

GetRoundInfoHandler will return RoundInfoJSON json array.

func SetStormDBInstance

func SetStormDBInstance(store *StormDBInstance)

SetStormDBInstance will set a store.

func StartAPI

func StartAPI(eb *eventbus.EventBus, rb *rpcbus.RPCBus)

StartAPI init consensus API pointers.

Types

type Count

type Count struct {
	Count int `json:"count"`
}

Count is the struct used to return a count for a API service.

type EventQueueJSON

type EventQueueJSON struct {
	ID        int              `storm:"id,increment" json:"id"` // primary key with auto increment
	Round     uint64           `json:"round"`
	Step      uint8            `json:"step"`
	Message   *message.Message `json:"message"`
	UpdatedAt time.Time        `json:"updated_at"`
}

EventQueueJSON is used as JSON rapper for eventQueue fields.

type Member

type Member struct {
	PublicKeyBLS []byte  `json:"bls_key"`
	Stakes       []Stake `json:"stakes"`
}

Member is the holder of bls and stakes.

type PeerCount

type PeerCount struct {
	ID       string    `storm:"id" json:"id"`
	LastSeen time.Time `storm:"index" json:"last_seen"`
}

PeerCount is the struct used to save a peer or remove from a PeerCount collection in the API monitoring database.

type PeerJSON

type PeerJSON struct {
	ID       int       `storm:"id,increment" json:"id"`
	Address  string    `json:"address"`
	Type     string    `storm:"index" json:"type"`
	Method   string    `storm:"index" json:"method"`
	LastSeen time.Time `storm:"index" json:"last_seen"`
}

PeerJSON is used as JSON wrapper for peer info fields.

type ProvisionerJSON

type ProvisionerJSON struct {
	ID      uint64        `storm:"id" json:"id"`
	Set     sortedset.Set `json:"set"`
	Members []*Member     `json:"members"`
}

ProvisionerJSON represents the Provisioner.

type RoundInfoJSON

type RoundInfoJSON struct {
	ID        int       `storm:"id,increment" json:"id"`
	Round     uint64    `storm:"index" json:"round"`
	Step      uint8     `json:"step"`
	UpdatedAt time.Time `json:"updated_at"`
	Method    string    `json:"method"`
	Name      string    `json:"name"`
}

RoundInfoJSON is used as JSON wrapper for round info fields.

type Stake

type Stake struct {
	Value       uint64 `json:"value"`
	Reward      uint64 `json:"reward"`
	Counter     uint64 `json:"counter"`
	Eligibility uint64 `json:"eligibility"`
}

Stake represents the Provisioner's stake.

type StormDBInstance

type StormDBInstance struct {
	DB *storm.DB
}

StormDBInstance holds db object.

func GetStormDBInstance

func GetStormDBInstance() *StormDBInstance

GetStormDBInstance will return the actual db instance or nil.

func NewStormDBInstance

func NewStormDBInstance(filename string) (*StormDBInstance, error)

NewStormDBInstance creates a new db.

func (*StormDBInstance) Close

func (bdb *StormDBInstance) Close() error

Close will close db.

func (*StormDBInstance) Delete

func (bdb *StormDBInstance) Delete(data interface{}) error

Delete will delete data.

func (*StormDBInstance) Find

func (bdb *StormDBInstance) Find(fieldName string, value interface{}, to interface{}) error

Find will find data.

func (*StormDBInstance) Save

func (bdb *StormDBInstance) Save(data interface{}) error

Save will save the data into db.

Jump to

Keyboard shortcuts

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