handler

package
v0.0.0-...-c604c84 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Response status codes
	// for the commands
	OK                         = 200
	CREATED                    = 201
	ACCEPTED                   = 202
	BAD_REQUEST                = 400
	NODE_NOT_FOUND             = 405
	SERVER_ERROR               = 500
	NODE_IS_INACCESSIBLE       = 503
	ENGINE_UNEXPECTED_ERROR    = 504
	COMMAND_TRANSFERRING_ERROR = 505
	ENGINE_NO_EQUIVALENT       = 604
)
View Source
var (
	CommandType               = ""
	Addresses                 []string
	ContractorID              = ""
	ChannelIDOnContractorSide = ""
	Amount                    = ""
	Offset                    = ""
	Count                     = ""
	Equivalent                = ""
	HistoryFrom               = ""
	HistoryTo                 = ""
	AmountFrom                = ""
	AmountTo                  = ""
	CryptoKey                 = ""
	Payload                   = ""
	AuditNumber               = ""
	IncomingAmount            = ""
	OutgoingAmount            = ""
	Balance                   = ""
)
View Source
var (
	PAYMENT_OPERATION_TIMEOUT uint16 = 60
	MAX_FLOW_FIRST_TIMEOUT    uint16 = 30
	MAX_FLOW_FULLY_TIMEOUT    uint16 = 60
	COMMAND_UUID_TIMEOUT      uint16 = 20
)
View Source
var (
	TRUST_LINE_RESULT_TIMEOUT  uint16 = 20 // seconds
	CONTRACTORS_RESULT_TIMEOUT uint16 = 20
	STATS_RESULT_TIMEOUT       uint16 = 20 // seconds
	DEFAULT_TRUST_LINES_OFFSET        = "0"
	DFEAULT_TRUST_LINES_COUNT         = "10000"
)
View Source
var (
	CHANNEL_RESULT_TIMEOUT uint16 = 20 // seconds
)
View Source
var (
	DELETE_CRYPTO_DATA_TIMEOUT uint16 = 20 // seconds
)
View Source
var (
	HISTORY_RESULT_TIMEOUT uint16 = 20 // seconds
)

Functions

func ValidateAddress

func ValidateAddress(value string) (string, string)

func ValidateInt

func ValidateInt(value string) bool

func ValidateTrustLineAmount

func ValidateTrustLineAmount(amount string) bool

Types

type Command

type Command struct {
	UUID uuid.UUID
	Body string
}

func NewCommand

func NewCommand(body ...string) *Command

func NewCommandWithUUID

func NewCommandWithUUID(transactionUUID uuid.UUID, body ...string) *Command

func (*Command) ToBytes

func (c *Command) ToBytes() []byte

type Node

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

Represents GEO engine node in the handler. Handles reading and writing of the fifo files.

func NewNode

func NewNode() *Node

func (*Node) BeginMonitorInternalProcessCrashes

func (node *Node) BeginMonitorInternalProcessCrashes(
	process *exec.Cmd,
	commandsGoroutineControlEvents chan *goroutineControlEvent,
	resultsGoroutineControlEvents chan *goroutineControlEvent)

func (*Node) GetResult

func (node *Node) GetResult(command *Command, timeoutSeconds uint16) (*Result, error)

func (*Node) SendCommand

func (node *Node) SendCommand(command *Command) error

Sends command to the engine.

func (*Node) Start

func (node *Node) Start() (*exec.Cmd, error)

func (*Node) StartCommunication

func (node *Node) StartCommunication() (chan *goroutineControlEvent, chan *goroutineControlEvent, error)

func (*Node) StopCommunication

func (node *Node) StopCommunication() error

func (*Node) WaitCommand

func (node *Node) WaitCommand(command *Command)

Wait for command result from the engine.

type NodesHandler

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

func InitNodesHandler

func InitNodesHandler() (*NodesHandler, error)

func (*NodesHandler) BatchMaxFullyTransaction

func (handler *NodesHandler) BatchMaxFullyTransaction(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ChannelInfo

func (handler *NodesHandler) ChannelInfo(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ChannelInfoByAddresses

func (handler *NodesHandler) ChannelInfoByAddresses(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) Channels

func (handler *NodesHandler) Channels()

func (*NodesHandler) CheckEventsMonitoringRunning

func (handler *NodesHandler) CheckEventsMonitoringRunning() bool

func (*NodesHandler) CheckNodeRunning

func (handler *NodesHandler) CheckNodeRunning() (bool, error)

func (*NodesHandler) ClearEventsMonitoringPID

func (handler *NodesHandler) ClearEventsMonitoringPID()

func (*NodesHandler) CloseIncomingTrustLine

func (handler *NodesHandler) CloseIncomingTrustLine(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) CreateTransaction

func (handler *NodesHandler) CreateTransaction(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) GetTransactionByCommandUUID

func (handler *NodesHandler) GetTransactionByCommandUUID(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) GetTrustLineByAddress

func (handler *NodesHandler) GetTrustLineByAddress(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) GetTrustLineByID

func (handler *NodesHandler) GetTrustLineByID(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) History

func (handler *NodesHandler) History()

func (*NodesHandler) HistoryWithContractor

func (handler *NodesHandler) HistoryWithContractor(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) IfNodeWaitForResult

func (handler *NodesHandler) IfNodeWaitForResult() bool

func (*NodesHandler) InitChannel

func (handler *NodesHandler) InitChannel(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) InitTrustLine

func (handler *NodesHandler) InitTrustLine(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ListChannels

func (handler *NodesHandler) ListChannels(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ListContractors

func (handler *NodesHandler) ListContractors(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ListEquivalents

func (handler *NodesHandler) ListEquivalents(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ListTrustLines

func (handler *NodesHandler) ListTrustLines(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ListTrustLinesAllEquivalents

func (handler *NodesHandler) ListTrustLinesAllEquivalents(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ListTrustLinesPortions

func (handler *NodesHandler) ListTrustLinesPortions(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) MaxFlow

func (handler *NodesHandler) MaxFlow()

func (*NodesHandler) Payment

func (handler *NodesHandler) Payment()

func (*NodesHandler) PaymentsAdditionalHistory

func (handler *NodesHandler) PaymentsAdditionalHistory(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) PaymentsHistory

func (handler *NodesHandler) PaymentsHistory(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) PaymentsHistoryAllEquivalents

func (handler *NodesHandler) PaymentsHistoryAllEquivalents(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) PublicKeysSharing

func (handler *NodesHandler) PublicKeysSharing(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) RegenerateAllKeys

func (handler *NodesHandler) RegenerateAllKeys(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) RegenerateChannelCryptoKey

func (handler *NodesHandler) RegenerateChannelCryptoKey(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) RemoveChannel

func (handler *NodesHandler) RemoveChannel(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) RemoveOutdatedCryptoData

func (handler *NodesHandler) RemoveOutdatedCryptoData(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) RemoveOutdatedCryptoDataCommand

func (handler *NodesHandler) RemoveOutdatedCryptoDataCommand()

func (*NodesHandler) RemoveTrustLine

func (handler *NodesHandler) RemoveTrustLine(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) ResetTrustLine

func (handler *NodesHandler) ResetTrustLine(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) RestoreNode

func (handler *NodesHandler) RestoreNode() error

func (*NodesHandler) RestoreNodeWithCommunication

func (handler *NodesHandler) RestoreNodeWithCommunication() error

func (*NodesHandler) SaveTrustLineEquivalentInfo

func (handler *NodesHandler) SaveTrustLineEquivalentInfo(equivalent string, file *os.File)

func (*NodesHandler) SaveTrustLineInfo

func (handler *NodesHandler) SaveTrustLineInfo(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) SetChannelAddresses

func (handler *NodesHandler) SetChannelAddresses(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) SetChannelCryptoKey

func (handler *NodesHandler) SetChannelCryptoKey(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) SetTrustLine

func (handler *NodesHandler) SetTrustLine(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) StartEventsMonitoring

func (handler *NodesHandler) StartEventsMonitoring() error

func (*NodesHandler) StartNodeForCommunication

func (handler *NodesHandler) StartNodeForCommunication() error

func (*NodesHandler) StopEventsMonitoring

func (handler *NodesHandler) StopEventsMonitoring() error

func (*NodesHandler) StopEverything

func (handler *NodesHandler) StopEverything(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) StopNode

func (handler *NodesHandler) StopNode() error

func (*NodesHandler) StopNodeCommunication

func (handler *NodesHandler) StopNodeCommunication() error

func (*NodesHandler) TotalBalance

func (handler *NodesHandler) TotalBalance(w http.ResponseWriter, r *http.Request)

func (*NodesHandler) TrustLines

func (handler *NodesHandler) TrustLines()

func (*NodesHandler) TrustLinesHistory

func (handler *NodesHandler) TrustLinesHistory(w http.ResponseWriter, r *http.Request)

type Result

type Result struct {
	UUID   uuid.UUID
	Code   int
	Tokens []string
	Error  error
}

func ResultFromRawInput

func ResultFromRawInput(body []byte) *Result

Parses the result from raw bytes sequence (often from the result.fifo file of some node)

Returns result even if bytes sequence was not parsed correctly. In that case, the Error field of the result would be set.

Jump to

Keyboard shortcuts

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