Documentation ¶
Index ¶
- Constants
- type ClientPreChannelCreateData
- type ClientPreChannelTopUpData
- type GasConf
- type Worker
- func (w *Worker) AccountUpdateBalances(job *data.Job) error
- func (w *Worker) AfterAccountAddBalance(job *data.Job) error
- func (w *Worker) AfterAccountReturnBalance(job *data.Job) error
- func (w *Worker) AgentAfterChannelCreate(job *data.Job) error
- func (w *Worker) AgentAfterChannelTopUp(job *data.Job) error
- func (w *Worker) AgentAfterCooperativeClose(job *data.Job) error
- func (w *Worker) AgentAfterOfferingDelete(job *data.Job) error
- func (w *Worker) AgentAfterOfferingMsgBCPublish(job *data.Job) error
- func (w *Worker) AgentAfterOfferingPopUp(job *data.Job) error
- func (w *Worker) AgentAfterUncooperativeClose(job *data.Job) error
- func (w *Worker) AgentAfterUncooperativeCloseRequest(job *data.Job) error
- func (w *Worker) AgentPreEndpointMsgCreate(job *data.Job) error
- func (w *Worker) AgentPreOfferingDelete(job *data.Job) error
- func (w *Worker) AgentPreOfferingMsgBCPublish(job *data.Job) error
- func (w *Worker) AgentPreOfferingPopUp(job *data.Job) error
- func (w *Worker) AgentPreServiceSuspend(job *data.Job) error
- func (w *Worker) AgentPreServiceTerminate(job *data.Job) error
- func (w *Worker) AgentPreServiceUnsuspend(job *data.Job) error
- func (w *Worker) ClientAfterChannelCreate(job *data.Job) error
- func (w *Worker) ClientAfterChannelTopUp(job *data.Job) error
- func (w *Worker) ClientAfterCooperativeClose(job *data.Job) error
- func (w *Worker) ClientAfterOfferingDelete(job *data.Job) error
- func (w *Worker) ClientAfterOfferingMsgBCPublish(job *data.Job) error
- func (w *Worker) ClientAfterOfferingPopUp(job *data.Job) error
- func (w *Worker) ClientAfterUncooperativeClose(job *data.Job) error
- func (w *Worker) ClientAfterUncooperativeCloseRequest(job *data.Job) error
- func (w *Worker) ClientCompleteServiceTransition(job *data.Job) error
- func (w *Worker) ClientEndpointCreate(job *data.Job) error
- func (w *Worker) ClientPreChannelCreate(job *data.Job) error
- func (w *Worker) ClientPreChannelTopUp(job *data.Job) error
- func (w *Worker) ClientPreServiceSuspend(job *data.Job) error
- func (w *Worker) ClientPreServiceTerminate(job *data.Job) error
- func (w *Worker) ClientPreServiceUnsuspend(job *data.Job) error
- func (w *Worker) ClientPreUncooperativeClose(job *data.Job) error
- func (w *Worker) ClientPreUncooperativeCloseRequest(job *data.Job) error
- func (w *Worker) DecrementCurrentSupply(job *data.Job) error
- func (w *Worker) IncrementCurrentSupply(job *data.Job) error
- func (w *Worker) PreAccountAddBalance(job *data.Job) error
- func (w *Worker) PreAccountAddBalanceApprove(job *data.Job) error
- func (w *Worker) PreAccountReturnBalance(job *data.Job) error
- func (w *Worker) SetProcessor(processor *proc.Processor)
- func (w *Worker) SetQueue(queue job.Queue)
Constants ¶
const ( ErrInternal errors.Error = 0x25E9<<8 + iota ErrInvalidJob ErrAccountNotFound ErrChannelNotFound ErrOfferingNotFound ErrUserNotFound ErrEndpointNotFound ErrTemplateNotFound ErrTemplateByHashNotFound ErrEthLogNotFound ErrProductNotFound ErrParseJobData ErrParsePrivateKey ErrParseEthAddr ErrParseOfferingHash ErrParseEthLog ErrWrongLogNonIndexedArgsNumber ErrWrongLogTopicsNumber ErrInsufficientPTCBalance ErrInsufficientPSCBalance ErrInsufficientEthBalance ErrSmallDeposit ErrFindApprovalBalanceData ErrPTCRetrieveBalance ErrPTCIncreaseApproval ErrPSCRetrieveBalance ErrPSCAddBalance ErrPSCReturnBalance ErrPSCCooperativeClose ErrPSCRegisterOffering ErrPSCRemoveOffering ErrPSCPopUpOffering ErrPSCOfferingSupply ErrPSCCreateChannel ErrPSCGetChannelInfo ErrPSCSettle ErrPSCTopUpChannel ErrPSCUncooperativeClose ErrEthGetTransaction ErrEthTxInPendingState ErrEthRetrieveBalance ErrEthLogChannelMismatch ErrEthLatestBlockNumber ErrRecoverClientPubKey ErrTerminateChannel ErrAddJob ErrSignClosingMsg ErrNoReceiptSignature ErrMakeEndpointMsg ErrEndpointMsgSeal ErrGeneratePasswordHash ErrPublishEndpoint ErrPublishOffering ErrFindOfferings ErrSOMCNoOfferings ErrOfferNotRegistered ErrOfferNotCorrespondToTemplate ErrChannelReceiptBalance ErrInvalidChannelStatus ErrInvalidServiceStatus ErrOfferingNoSupply ErrGetEndpoint ErrDecryptEndpointMsg ErrInvalidEndpoint ErrFailedStopService ErrFailedStartService ErrChallengePeriodIsNotOver ErrWrongOfferingMsgSignature ErrOfferingExists ErrUncompletedJobsExists ErrOfferingNotActive ErrPopUpPeriodIsNotOver ErrOfferingDeletePeriodIsNotOver ErrOfferingDeposit ErrTorNoSet )
Errors returned by workers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientPreChannelCreateData ¶
type ClientPreChannelCreateData struct { Account string `json:"account"` Offering string `json:"offering"` GasPrice uint64 `json:"gasPrice"` Deposit uint64 `json:"deposit"` }
ClientPreChannelCreateData is a job data for ClientPreChannelCreate.
type ClientPreChannelTopUpData ¶
type ClientPreChannelTopUpData struct { Channel string `json:"channel"` GasPrice uint64 `json:"gasPrice"` }
ClientPreChannelTopUpData is a job data for ClientPreChannelTopUp.
type GasConf ¶
type GasConf struct { PTC struct { Approve uint64 } PSC struct { AddBalanceERC20 uint64 RegisterServiceOffering uint64 CreateChannel uint64 CooperativeClose uint64 ReturnBalanceERC20 uint64 SetNetworkFee uint64 UncooperativeClose uint64 Settle uint64 TopUp uint64 GetChannelInfo uint64 PublishServiceOfferingEndpoint uint64 GetKey uint64 BalanceOf uint64 PopupServiceOffering uint64 RemoveServiceOffering uint64 } }
GasConf amounts of gas limit to use for contracts calls.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker has all worker routines.
func NewWorker ¶
func NewWorker(logger log.Logger, db *reform.DB, ethBack eth.Backend, gasConc *GasConf, pscAddr common.Address, payAddr string, pwdGetter data.PWDGetter, countryConf *country.Config, decryptKeyFunc data.ToPrivateKeyFunc, eptConf *ept.Config, torHostname string, somcClientBuilder somc.ClientBuilderInterface) (*Worker, error)
NewWorker returns new instance of worker.
func (*Worker) AccountUpdateBalances ¶
AccountUpdateBalances updates ptc, psc and eth balance values.
func (*Worker) AfterAccountAddBalance ¶
AfterAccountAddBalance updates psc and ptc balance of an account.
func (*Worker) AfterAccountReturnBalance ¶
AfterAccountReturnBalance updates psc and ptc balance of an account.
func (*Worker) AgentAfterChannelCreate ¶
AgentAfterChannelCreate registers client and creates pre service create job.
func (*Worker) AgentAfterChannelTopUp ¶
AgentAfterChannelTopUp updates deposit of a channel.
func (*Worker) AgentAfterCooperativeClose ¶
AgentAfterCooperativeClose marks channel as closed coop.
func (*Worker) AgentAfterOfferingDelete ¶
AgentAfterOfferingDelete set offering status to `remove`
func (*Worker) AgentAfterOfferingMsgBCPublish ¶
AgentAfterOfferingMsgBCPublish updates offering status and creates somc publish job.
func (*Worker) AgentAfterOfferingPopUp ¶
AgentAfterOfferingPopUp updates the block number when the offering was updated.
func (*Worker) AgentAfterUncooperativeClose ¶
AgentAfterUncooperativeClose marks channel closed uncoop.
func (*Worker) AgentAfterUncooperativeCloseRequest ¶
AgentAfterUncooperativeCloseRequest sets channel's status to challenge period.
func (*Worker) AgentPreEndpointMsgCreate ¶
AgentPreEndpointMsgCreate prepares endpoint message.
func (*Worker) AgentPreOfferingDelete ¶
AgentPreOfferingDelete calls psc remove an offering.
func (*Worker) AgentPreOfferingMsgBCPublish ¶
AgentPreOfferingMsgBCPublish publishes offering to blockchain.
func (*Worker) AgentPreOfferingPopUp ¶
AgentPreOfferingPopUp pop ups an offering.
func (*Worker) AgentPreServiceSuspend ¶
AgentPreServiceSuspend marks service as suspended.
func (*Worker) AgentPreServiceTerminate ¶
AgentPreServiceTerminate terminates the service.
func (*Worker) AgentPreServiceUnsuspend ¶
AgentPreServiceUnsuspend marks service as active.
func (*Worker) ClientAfterChannelCreate ¶
ClientAfterChannelCreate activates channel and triggers endpoint retrieval.
func (*Worker) ClientAfterChannelTopUp ¶
ClientAfterChannelTopUp updates deposit of a channel.
func (*Worker) ClientAfterCooperativeClose ¶
ClientAfterCooperativeClose changed channel status to closed cooperative and launches of terminate service procedure.
func (*Worker) ClientAfterOfferingDelete ¶
ClientAfterOfferingDelete sets offer status to `remove`;
func (*Worker) ClientAfterOfferingMsgBCPublish ¶
ClientAfterOfferingMsgBCPublish creates offering.
func (*Worker) ClientAfterOfferingPopUp ¶
ClientAfterOfferingPopUp updates offering in db or retrieves from somc if new.
func (*Worker) ClientAfterUncooperativeClose ¶
ClientAfterUncooperativeClose changed channel status to closed uncooperative.
func (*Worker) ClientAfterUncooperativeCloseRequest ¶
ClientAfterUncooperativeCloseRequest waits for the channel to uncooperative close, starts the service termination process.
func (*Worker) ClientCompleteServiceTransition ¶
func (*Worker) ClientEndpointCreate ¶
ClientEndpointCreate decodes endpoint message, saves it in the DB and triggers product configuration.
func (*Worker) ClientPreChannelCreate ¶
ClientPreChannelCreate triggers a channel creation.
func (*Worker) ClientPreChannelTopUp ¶
ClientPreChannelTopUp checks client balance and creates transaction for increase the channel deposit.
func (*Worker) ClientPreServiceSuspend ¶
ClientPreServiceSuspend suspends service.
func (*Worker) ClientPreServiceTerminate ¶
ClientPreServiceTerminate terminates service.
func (*Worker) ClientPreServiceUnsuspend ¶
ClientPreServiceUnsuspend activates service.
func (*Worker) ClientPreUncooperativeClose ¶
ClientPreUncooperativeClose waiting for until the challenge period is over. Then deletes the channel and settles by transferring the balance to the Agent and the rest of the deposit back to the Client.
func (*Worker) ClientPreUncooperativeCloseRequest ¶
ClientPreUncooperativeCloseRequest requests the closing of the channel and starts the challenge period.
func (*Worker) DecrementCurrentSupply ¶
DecrementCurrentSupply finds offering and decrements its current supply.
func (*Worker) IncrementCurrentSupply ¶
IncrementCurrentSupply finds offering and increments its current supply.
func (*Worker) PreAccountAddBalance ¶
PreAccountAddBalance adds balance to psc.
func (*Worker) PreAccountAddBalanceApprove ¶
PreAccountAddBalanceApprove approve balance if amount exists.
func (*Worker) PreAccountReturnBalance ¶
PreAccountReturnBalance returns from psc to ptc.
func (*Worker) SetProcessor ¶
SetProcessor sets a processor.