Documentation
¶
Index ¶
- Variables
- type EthBackend
- type GasConf
- type Worker
- func (w *Worker) AccountAddCheckBalance(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) AgentAfterEndpointMsgSOMCPublish(job *data.Job) error
- func (w *Worker) AgentAfterOfferingMsgBCPublish(job *data.Job) error
- func (w *Worker) AgentAfterUncooperativeClose(job *data.Job) error
- func (w *Worker) AgentAfterUncooperativeCloseRequest(job *data.Job) error
- func (w *Worker) AgentPreCooperativeClose(job *data.Job) error
- func (w *Worker) AgentPreEndpointMsgCreate(job *data.Job) error
- func (w *Worker) AgentPreEndpointMsgSOMCPublish(job *data.Job) error
- func (w *Worker) AgentPreOfferingMsgBCPublish(job *data.Job) error
- func (w *Worker) AgentPreOfferingMsgSOMCPublish(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) ClientPreChannelCreate(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 (h *Worker) SetQueue(queue *job.Queue)
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidJob = errors.New("unexpected job type or job related type")
)
Errors returned by workers.
Functions ¶
This section is empty.
Types ¶
type EthBackend ¶
type EthBackend interface {
CooperativeClose(*bind.TransactOpts, common.Address, uint32,
[common.HashLength]byte, *big.Int, []byte, []byte) (*types.Transaction, error)
GetTransactionByHash(context.Context, common.Hash) (*types.Transaction, bool, error)
RegisterServiceOffering(*bind.TransactOpts, [common.HashLength]byte,
*big.Int, uint16) (*types.Transaction, error)
PTCBalanceOf(*bind.CallOpts, common.Address) (*big.Int, error)
PTCIncreaseApproval(*bind.TransactOpts, common.Address, *big.Int) (*types.Transaction, error)
PSCBalanceOf(*bind.CallOpts, common.Address) (*big.Int, error)
PSCAddBalanceERC20(*bind.TransactOpts, *big.Int) (*types.Transaction, error)
PSCReturnBalanceERC20(*bind.TransactOpts, *big.Int) (*types.Transaction, error)
EthBalanceAt(context.Context, common.Address) (*big.Int, error)
}
EthBackend adapter to communicate with contract.
func NewEthBackend ¶
func NewEthBackend(psc *contract.PrivatixServiceContract, ptc *contract.PrivatixTokenContract, conn *ethclient.Client) EthBackend
NewEthBackend returns eth back implementation.
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(db *reform.DB, somc *somc.Conn, ethBack EthBackend, gasConc *GasConf, pscAddr common.Address, payAddr string, pwdGetter data.PWDGetter, decryptKeyFunc data.ToPrivateKeyFunc) (*Worker, error)
NewWorker returns new instance of worker.
func (*Worker) AccountAddCheckBalance ¶
AccountAddCheckBalance 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) AgentAfterEndpointMsgSOMCPublish ¶
AgentAfterEndpointMsgSOMCPublish suspends service if some pre payment expected.
func (*Worker) AgentAfterOfferingMsgBCPublish ¶
AgentAfterOfferingMsgBCPublish updates offering status and creates somc publish job.
func (*Worker) AgentAfterUncooperativeClose ¶
AgentAfterUncooperativeClose marks channel closed uncoop.
func (*Worker) AgentAfterUncooperativeCloseRequest ¶
AgentAfterUncooperativeCloseRequest sets channel's status to challenge period.
func (*Worker) AgentPreCooperativeClose ¶
AgentPreCooperativeClose call contract cooperative close method and trigger service terminate job.
func (*Worker) AgentPreEndpointMsgCreate ¶
AgentPreEndpointMsgCreate prepares endpoint message to be sent to client.
func (*Worker) AgentPreEndpointMsgSOMCPublish ¶
AgentPreEndpointMsgSOMCPublish sends msg to somc and creates after job.
func (*Worker) AgentPreOfferingMsgBCPublish ¶
AgentPreOfferingMsgBCPublish publishes offering to blockchain.
func (*Worker) AgentPreOfferingMsgSOMCPublish ¶
AgentPreOfferingMsgSOMCPublish publishes to somc and creates after job.
func (*Worker) AgentPreServiceSuspend ¶
AgentPreServiceSuspend marks service as suspended.
func (*Worker) AgentPreServiceTerminate ¶
AgentPreServiceTerminate marks service as active.
func (*Worker) AgentPreServiceUnsuspend ¶
AgentPreServiceUnsuspend marks service as active.
func (*Worker) ClientPreChannelCreate ¶
ClientPreChannelCreate creates channel.
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.