storage

package
v0.0.0-...-ab58f20 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoTxID = uint32(0) // reserved for non-transactional operations
)

Variables

View Source
var (
	ErrTxConflict = errors.New("Transaction conflict")
	ErrTxInvalid  = errors.New("Invalid transaction")
	ErrReadOnly   = errors.New("Cannot modify read-only store")
)

Functions

This section is empty.

Types

type ChanState

type ChanState struct {
	State     string
	Timestamp int64
}

type DAL

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

func NewDAL

func NewDAL(store KVStore) *DAL

func (*DAL) DeleteChannelMessage

func (d *DAL) DeleteChannelMessage(cid ctype.CidType, seqnum uint64) error

func (*DAL) DeleteChannelSeqNums

func (d *DAL) DeleteChannelSeqNums(cid ctype.CidType) error

func (*DAL) DeleteChannelState

func (d *DAL) DeleteChannelState(cid ctype.CidType) error

func (*DAL) DeleteConditionalPay

func (d *DAL) DeleteConditionalPay(payID ctype.PayIDType) error

func (*DAL) DeleteCooperativeWithdrawJob

func (d *DAL) DeleteCooperativeWithdrawJob(withdrawHash string) error

func (*DAL) DeleteDepositJob

func (d *DAL) DeleteDepositJob(jobID string) error

func (*DAL) DeleteDepositTxHashToJobID

func (d *DAL) DeleteDepositTxHashToJobID(txHash string) error

func (*DAL) DeleteEdge

func (d *DAL) DeleteEdge(token ctype.Addr, cid ctype.CidType) error

func (*DAL) DeleteEventMonitorBit

func (d *DAL) DeleteEventMonitorBit(eventName string) error

func (*DAL) DeleteLogEventWatch

func (d *DAL) DeleteLogEventWatch(name string) error

func (*DAL) DeleteOnChainBalance

func (d *DAL) DeleteOnChainBalance(cid ctype.CidType) error

func (*DAL) DeletePayEgressState

func (d *DAL) DeletePayEgressState(payID ctype.PayIDType) error

func (*DAL) DeletePayIngressState

func (d *DAL) DeletePayIngressState(payID ctype.PayIDType) error

func (*DAL) DeletePeer

func (d *DAL) DeletePeer(cid ctype.CidType) error

func (*DAL) DeletePeerActiveChannels

func (d *DAL) DeletePeerActiveChannels(peer string) error

func (*DAL) DeleteRoute

func (d *DAL) DeleteRoute(dest, tokenAddr string) error

func (*DAL) DeleteSecretRegistry

func (d *DAL) DeleteSecretRegistry(hash string) error

func (*DAL) DeleteServingOsp

func (d *DAL) DeleteServingOsp(clientAddr ctype.Addr, tokenAddr ctype.Addr, ospAddr ctype.Addr) error

func (*DAL) DeleteSimplexState

func (d *DAL) DeleteSimplexState(cid ctype.CidType, owner string) error

func (*DAL) GetAllChannelMessageSeqnums

func (d *DAL) GetAllChannelMessageSeqnums(cid ctype.CidType) ([]uint64, error)

func (*DAL) GetAllChannelStateKeys

func (d *DAL) GetAllChannelStateKeys() ([]ctype.CidType, error)

func (*DAL) GetAllConditionalPays

func (d *DAL) GetAllConditionalPays() ([]*entity.ConditionalPay, error)

func (*DAL) GetAllCooperativeWithdrawJobKeys

func (d *DAL) GetAllCooperativeWithdrawJobKeys() ([]string, error)

func (*DAL) GetAllDepositJobKeys

func (d *DAL) GetAllDepositJobKeys() ([]string, error)

func (*DAL) GetAllEdgeTokens

func (d *DAL) GetAllEdgeTokens() (map[ctype.Addr]bool, error)

func (*DAL) GetAllLogEventWatchKeys

func (d *DAL) GetAllLogEventWatchKeys() ([]string, error)

func (*DAL) GetAllMarkedOsp

func (d *DAL) GetAllMarkedOsp() (map[ctype.Addr]bool, error)

func (*DAL) GetAllOnChainBalanceKeys

func (d *DAL) GetAllOnChainBalanceKeys() ([]ctype.CidType, error)

func (*DAL) GetAllPaymentStateKeys

func (d *DAL) GetAllPaymentStateKeys() ([]ctype.PayIDType, []ctype.PayIDType, error)

func (*DAL) GetAllPeerLookUpTableKeys

func (d *DAL) GetAllPeerLookUpTableKeys() ([]ctype.CidType, error)

func (*DAL) GetAllRoutes

func (d *DAL) GetAllRoutes() (map[ctype.Addr]map[ctype.Addr]ctype.CidType, error)

func (*DAL) GetAllRoutingTableKeys

func (d *DAL) GetAllRoutingTableKeys() ([]string, error)

func (*DAL) GetAllRoutingTableKeysToDest

func (d *DAL) GetAllRoutingTableKeysToDest(dest string) ([]string, error)

func (*DAL) GetAllSecretRegistryKeys

func (d *DAL) GetAllSecretRegistryKeys() ([]string, error)

func (*DAL) GetAllServingOsps

func (d *DAL) GetAllServingOsps() (map[ctype.Addr]map[ctype.Addr]servingOspMap, error)

GetAllServingOsps returns (tokenAddr,client)->map[ospaddr]bool

func (*DAL) GetChannelMessage

func (d *DAL) GetChannelMessage(cid ctype.CidType, seqnum uint64) (*rpc.CelerMsg, error)

func (*DAL) GetChannelSeqNums

func (d *DAL) GetChannelSeqNums(cid ctype.CidType) (*common.ChannelSeqNums, error)

func (*DAL) GetChannelState

func (d *DAL) GetChannelState(cid ctype.CidType) (string, int64, error)

GetChannelState returns channel status, last update timestamp, and err msg

func (*DAL) GetCidByPeerAndToken

func (d *DAL) GetCidByPeerAndToken(peer []byte, token *entity.TokenInfo) ctype.CidType

Ideally we should enforce peer type as well, use []byte is easy for value from proto msg

func (*DAL) GetCidByPeerAndTokenWithErr

func (d *DAL) GetCidByPeerAndTokenWithErr(peer []byte, token *entity.TokenInfo) (ctype.CidType, bool, error)

func (*DAL) GetConditionalPay

func (d *DAL) GetConditionalPay(payID ctype.PayIDType) (*entity.ConditionalPay, []byte, error)

func (*DAL) GetCooperativeWithdrawJob

func (d *DAL) GetCooperativeWithdrawJob(withdrawHash string) (*jobs.CooperativeWithdrawJob, error)

func (*DAL) GetDepositJob

func (d *DAL) GetDepositJob(jobID string) (*jobs.DepositJob, error)

func (*DAL) GetDepositTxHashToJobID

func (d *DAL) GetDepositTxHashToJobID(txHash string) (string, error)

func (*DAL) GetEdges

func (d *DAL) GetEdges(token ctype.Addr) (map[ctype.CidType]*graph.Edge, error)

func (*DAL) GetLastOpenChanReqBlkNum

func (d *DAL) GetLastOpenChanReqBlkNum(peer []byte, token *entity.TokenInfo) (int64, error)

func (*DAL) GetLogEventWatch

func (d *DAL) GetLogEventWatch(name string) (*structs.LogEventID, error)

func (*DAL) GetOnChainBalance

func (d *DAL) GetOnChainBalance(cid ctype.CidType) (*structs.OnChainBalance, error)

func (*DAL) GetPayEgressState

func (d *DAL) GetPayEgressState(payID ctype.PayIDType) (ctype.CidType, string, int64, error)

GetPayEgressState returns pay egress cid, status, timestamp, err for a given payID

func (*DAL) GetPayIngressState

func (d *DAL) GetPayIngressState(payID ctype.PayIDType) (ctype.CidType, string, int64, error)

GetPayIngressState returns pay ingress cid, status, timestamp, err for a given payID

func (*DAL) GetPayNote

func (d *DAL) GetPayNote(payID ctype.PayIDType) (*any.Any, error)

func (*DAL) GetPeer

func (d *DAL) GetPeer(cid ctype.CidType) (string, error)

func (*DAL) GetPeerActiveChannels

func (d *DAL) GetPeerActiveChannels(peer string) (map[ctype.CidType]bool, error)

func (*DAL) GetRoute

func (d *DAL) GetRoute(dest, tokenAddr string) (ctype.CidType, error)

func (*DAL) GetSecretRegistry

func (d *DAL) GetSecretRegistry(hash string) (string, error)

func (*DAL) GetServingOsps

func (d *DAL) GetServingOsps(clientAddr ctype.Addr, tokenAddr ctype.Addr) (servingOspMap, error)

func (*DAL) GetSimplexPaymentChannel

func (d *DAL) GetSimplexPaymentChannel(cid ctype.CidType, owner string) (*entity.SimplexPaymentChannel, *rpc.SignedSimplexState, error)

func (*DAL) GetTokenContractAddr

func (d *DAL) GetTokenContractAddr(cid ctype.CidType) (string, error)

func (*DAL) HasChannelMessage

func (d *DAL) HasChannelMessage(cid ctype.CidType, seqnum uint64) (bool, error)

func (*DAL) HasChannelSeqNums

func (d *DAL) HasChannelSeqNums(cid ctype.CidType) (bool, error)

func (*DAL) HasChannelState

func (d *DAL) HasChannelState(cid ctype.CidType) (bool, error)

func (*DAL) HasCooperativeWithdrawJob

func (d *DAL) HasCooperativeWithdrawJob(withdrawHash string) (bool, error)

func (*DAL) HasDepositJob

func (d *DAL) HasDepositJob(jobID string) (bool, error)

func (*DAL) HasDepositTxHashToJobID

func (d *DAL) HasDepositTxHashToJobID(txHash string) (bool, error)

func (*DAL) HasEventMonitorBit

func (d *DAL) HasEventMonitorBit(eventName string) (bool, error)

func (*DAL) HasLogEventWatch

func (d *DAL) HasLogEventWatch(name string) (bool, error)

func (*DAL) HasOnChainBalance

func (d *DAL) HasOnChainBalance(cid ctype.CidType) (bool, error)

func (*DAL) HasPayEgressState

func (d *DAL) HasPayEgressState(payID ctype.PayIDType) (bool, error)

func (*DAL) HasPayIngressState

func (d *DAL) HasPayIngressState(payID ctype.PayIDType) (bool, error)

func (*DAL) HasPeer

func (d *DAL) HasPeer(cid ctype.CidType) (bool, error)

func (*DAL) HasPeerActiveChannels

func (d *DAL) HasPeerActiveChannels(peer string) (bool, error)

func (*DAL) HasRoute

func (d *DAL) HasRoute(dest, tokenAddr string) (bool, error)

func (*DAL) HasSecretRegistry

func (d *DAL) HasSecretRegistry(hash string) (bool, error)

func (*DAL) MarkOsp

func (d *DAL) MarkOsp(osp ctype.Addr)

func (*DAL) OpenTransaction

func (d *DAL) OpenTransaction() (*DALTx, error)

func (*DAL) PutChannelMessage

func (d *DAL) PutChannelMessage(cid ctype.CidType, seqnum uint64, msg *rpc.CelerMsg) error

func (*DAL) PutChannelSeqNums

func (d *DAL) PutChannelSeqNums(cid ctype.CidType, seqnums *common.ChannelSeqNums) error

func (*DAL) PutChannelState

func (d *DAL) PutChannelState(cid ctype.CidType, state string) error

func (*DAL) PutCidForPeerAndToken

func (d *DAL) PutCidForPeerAndToken(peer []byte, token *entity.TokenInfo, cid ctype.CidType) error

func (*DAL) PutConditionalPay

func (d *DAL) PutConditionalPay(payBytes []byte) error

save payBytes, autogen key from hash, skip if already exists

func (*DAL) PutCooperativeWithdrawJob

func (d *DAL) PutCooperativeWithdrawJob(
	withdrawHash string, job *jobs.CooperativeWithdrawJob) error

func (*DAL) PutDepositJob

func (d *DAL) PutDepositJob(jobID string, job *jobs.DepositJob) error

func (*DAL) PutDepositTxHashToJobID

func (d *DAL) PutDepositTxHashToJobID(txHash string, jobID string) error

func (*DAL) PutEdge

func (d *DAL) PutEdge(token ctype.Addr, cid ctype.CidType, edge *graph.Edge) error

func (*DAL) PutEventMonitorBit

func (d *DAL) PutEventMonitorBit(eventName string) error

func (*DAL) PutLastOpenChanReqBlkNum

func (d *DAL) PutLastOpenChanReqBlkNum(peer []byte, token *entity.TokenInfo, blkNum int64) error

func (*DAL) PutLogEventWatch

func (d *DAL) PutLogEventWatch(name string, id *structs.LogEventID) error

func (*DAL) PutOnChainBalance

func (d *DAL) PutOnChainBalance(cid ctype.CidType, balance *structs.OnChainBalance) error

func (*DAL) PutPayEgressState

func (d *DAL) PutPayEgressState(payID ctype.PayIDType, cid ctype.CidType, status string) error

PutPayEgressState write pay egress cid, status for a given payID

func (*DAL) PutPayIngressState

func (d *DAL) PutPayIngressState(payID ctype.PayIDType, cid ctype.CidType, status string) error

PutPayIngressState write pay ingress cid, status for a given payID

func (*DAL) PutPayNote

func (d *DAL) PutPayNote(condPay *entity.ConditionalPay, note *any.Any) error

func (*DAL) PutPeer

func (d *DAL) PutPeer(cid ctype.CidType, peer string) error

func (*DAL) PutPeerActiveChannels

func (d *DAL) PutPeerActiveChannels(peer string, cids map[ctype.CidType]bool) error

func (*DAL) PutRoute

func (d *DAL) PutRoute(dest, tokenAddr string, nextHop ctype.CidType) error

func (*DAL) PutSecretRegistry

func (d *DAL) PutSecretRegistry(hash, preimage string) error

func (*DAL) PutServingOsp

func (d *DAL) PutServingOsp(clientAddr ctype.Addr, tokenAddr ctype.Addr, ospAddr ctype.Addr) error

func (*DAL) PutSimplexState

func (d *DAL) PutSimplexState(cid ctype.CidType, owner string, simplexState *rpc.SignedSimplexState) error

func (*DAL) PutTokenContractAddr

func (d *DAL) PutTokenContractAddr(cid ctype.CidType, addr string) error

func (*DAL) ScanAllCidsByPeer

func (d *DAL) ScanAllCidsByPeer(peer []byte) []ctype.CidType

ScanAllCidsByPeer does key scan and is expensive! only hello, sync_db and messenger/queue should call this to proper handle old db schema transition to new one that has peerActiveChannels table new code should only use peerActiveChannels

func (*DAL) Transactional

func (d *DAL) Transactional(callback TxFunc, args ...interface{}) error

func (*DAL) UnmarkOsp

func (d *DAL) UnmarkOsp(osp ctype.Addr)

type DALTx

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

func (*DALTx) Commit

func (tx *DALTx) Commit() error

func (*DALTx) ConvertError

func (tx *DALTx) ConvertError(err error) error

func (*DALTx) DeleteChannelMessage

func (dtx *DALTx) DeleteChannelMessage(cid ctype.CidType, seqnum uint64) error

func (*DALTx) DeleteChannelSeqNums

func (dtx *DALTx) DeleteChannelSeqNums(cid ctype.CidType) error

func (*DALTx) DeleteChannelState

func (dtx *DALTx) DeleteChannelState(cid ctype.CidType) error

func (*DALTx) DeleteConditionalPay

func (dtx *DALTx) DeleteConditionalPay(payID ctype.PayIDType) error

func (*DALTx) DeleteCooperativeWithdrawJob

func (dtx *DALTx) DeleteCooperativeWithdrawJob(withdrawHash string) error

func (*DALTx) DeleteDepositJob

func (dtx *DALTx) DeleteDepositJob(jobID string) error

func (*DALTx) DeleteDepositTxHashToJobID

func (dtx *DALTx) DeleteDepositTxHashToJobID(txHash string) error

func (*DALTx) DeleteEventMonitorBit

func (dtx *DALTx) DeleteEventMonitorBit(eventName string) error

func (*DALTx) DeleteLogEventWatch

func (dtx *DALTx) DeleteLogEventWatch(name string) error

func (*DALTx) DeleteOnChainBalance

func (dtx *DALTx) DeleteOnChainBalance(cid ctype.CidType) error

func (*DALTx) DeleteOpenChannelTs

func (dtx *DALTx) DeleteOpenChannelTs(peerAddr ctype.Addr, tokenAddr ctype.Addr) error

func (*DALTx) DeletePayEgressState

func (dtx *DALTx) DeletePayEgressState(payID ctype.PayIDType) error

func (*DALTx) DeletePayIngressState

func (dtx *DALTx) DeletePayIngressState(payID ctype.PayIDType) error

func (*DALTx) DeletePeer

func (dtx *DALTx) DeletePeer(cid ctype.CidType) error

func (*DALTx) DeletePeerActiveChannels

func (dtx *DALTx) DeletePeerActiveChannels(peer string) error

func (*DALTx) DeleteRoute

func (dtx *DALTx) DeleteRoute(dest, tokenAddr string) error

func (*DALTx) DeleteSecretRegistry

func (dtx *DALTx) DeleteSecretRegistry(hash string) error

func (*DALTx) DeleteSimplexState

func (dtx *DALTx) DeleteSimplexState(cid ctype.CidType, owner string) error

func (*DALTx) Discard

func (tx *DALTx) Discard()

func (*DALTx) GetAllChannelMessageSeqnums

func (dtx *DALTx) GetAllChannelMessageSeqnums(cid ctype.CidType) ([]uint64, error)

func (*DALTx) GetAllChannelStateKeys

func (dtx *DALTx) GetAllChannelStateKeys() ([]ctype.CidType, error)

func (*DALTx) GetAllConditionalPays

func (dtx *DALTx) GetAllConditionalPays() ([]*entity.ConditionalPay, error)

func (*DALTx) GetAllCooperativeWithdrawJobKeys

func (dtx *DALTx) GetAllCooperativeWithdrawJobKeys() ([]string, error)

func (*DALTx) GetAllDepositJobKeys

func (dtx *DALTx) GetAllDepositJobKeys() ([]string, error)

func (*DALTx) GetAllLogEventWatchKeys

func (dtx *DALTx) GetAllLogEventWatchKeys() ([]string, error)

func (*DALTx) GetAllOnChainBalanceKeys

func (dtx *DALTx) GetAllOnChainBalanceKeys() ([]ctype.CidType, error)

func (*DALTx) GetAllPaymentStateKeys

func (dtx *DALTx) GetAllPaymentStateKeys() ([]ctype.PayIDType, []ctype.PayIDType, error)

func (*DALTx) GetAllPeerLookUpTableKeys

func (dtx *DALTx) GetAllPeerLookUpTableKeys() ([]ctype.CidType, error)

func (*DALTx) GetAllRoutingTableKeys

func (dtx *DALTx) GetAllRoutingTableKeys() ([]string, error)

func (*DALTx) GetAllRoutingTableKeysToDest

func (dtx *DALTx) GetAllRoutingTableKeysToDest(dest string) ([]string, error)

func (*DALTx) GetAllSecretRegistryKeys

func (dtx *DALTx) GetAllSecretRegistryKeys() ([]string, error)

func (*DALTx) GetChannelMessage

func (dtx *DALTx) GetChannelMessage(cid ctype.CidType, seqnum uint64) (*rpc.CelerMsg, error)

func (*DALTx) GetChannelSeqNums

func (dtx *DALTx) GetChannelSeqNums(cid ctype.CidType) (*common.ChannelSeqNums, error)

func (*DALTx) GetChannelState

func (dtx *DALTx) GetChannelState(cid ctype.CidType) (string, int64, error)

GetChannelState returns channel status, last update timestamp, and err msg

func (*DALTx) GetCidByPeerAndToken

func (dtx *DALTx) GetCidByPeerAndToken(peer []byte, token *entity.TokenInfo) ctype.CidType

func (*DALTx) GetConditionalPay

func (dtx *DALTx) GetConditionalPay(payID ctype.PayIDType) (*entity.ConditionalPay, []byte, error)

func (*DALTx) GetCooperativeWithdrawJob

func (dtx *DALTx) GetCooperativeWithdrawJob(
	withdrawHash string) (*jobs.CooperativeWithdrawJob, error)

func (*DALTx) GetDepositJob

func (dtx *DALTx) GetDepositJob(jobID string) (*jobs.DepositJob, error)

func (*DALTx) GetDepositTxHashToJobID

func (dtx *DALTx) GetDepositTxHashToJobID(txHash string) (string, error)

func (*DALTx) GetLastOpenChanReqBlkNum

func (dtx *DALTx) GetLastOpenChanReqBlkNum(peer []byte, token *entity.TokenInfo) (int64, error)

func (*DALTx) GetLogEventWatch

func (dtx *DALTx) GetLogEventWatch(name string) (*structs.LogEventID, error)

func (*DALTx) GetOnChainBalance

func (dtx *DALTx) GetOnChainBalance(cid ctype.CidType) (*structs.OnChainBalance, error)

func (*DALTx) GetOpenChannelTs

func (dtx *DALTx) GetOpenChannelTs(peerAddr ctype.Addr, tokenAddr ctype.Addr) (*openchannelts.OpenChannelTs, error)

func (*DALTx) GetPayEgressState

func (dtx *DALTx) GetPayEgressState(payID ctype.PayIDType) (ctype.CidType, string, int64, error)

GetPayEgressState returns pay egress cid, status, timestamp, err for a given payID

func (*DALTx) GetPayIngressState

func (dtx *DALTx) GetPayIngressState(payID ctype.PayIDType) (ctype.CidType, string, int64, error)

GetPayIngressState returns pay ingress cid, status, timestamp, err for a given payID

func (*DALTx) GetPayNote

func (dtx *DALTx) GetPayNote(payID ctype.PayIDType) (*any.Any, error)

func (*DALTx) GetPeer

func (dtx *DALTx) GetPeer(cid ctype.CidType) (string, error)

func (*DALTx) GetPeerActiveChannels

func (dtx *DALTx) GetPeerActiveChannels(peer string) (map[ctype.CidType]bool, error)

func (*DALTx) GetRoute

func (dtx *DALTx) GetRoute(dest, tokenAddr string) (ctype.CidType, error)

func (*DALTx) GetSecretRegistry

func (dtx *DALTx) GetSecretRegistry(hash string) (string, error)

func (*DALTx) GetSimplexPaymentChannel

func (dtx *DALTx) GetSimplexPaymentChannel(cid ctype.CidType, owner string) (*entity.SimplexPaymentChannel, *rpc.SignedSimplexState, error)

func (*DALTx) GetTokenContractAddr

func (dtx *DALTx) GetTokenContractAddr(cid ctype.CidType) (string, error)

func (*DALTx) HasChannelMessage

func (dtx *DALTx) HasChannelMessage(cid ctype.CidType, seqnum uint64) (bool, error)

func (*DALTx) HasChannelSeqNums

func (dtx *DALTx) HasChannelSeqNums(cid ctype.CidType) (bool, error)

func (*DALTx) HasChannelState

func (dtx *DALTx) HasChannelState(cid ctype.CidType) (bool, error)

func (*DALTx) HasCooperativeWithdrawJob

func (dtx *DALTx) HasCooperativeWithdrawJob(withdrawHash string) (bool, error)

func (*DALTx) HasDepositJob

func (dtx *DALTx) HasDepositJob(jobID string) (bool, error)

func (*DALTx) HasDepositTxHashToJobID

func (dtx *DALTx) HasDepositTxHashToJobID(txHash string) (bool, error)

func (*DALTx) HasEventMonitorBit

func (dtx *DALTx) HasEventMonitorBit(eventName string) (bool, error)

func (*DALTx) HasLogEventWatch

func (dtx *DALTx) HasLogEventWatch(name string) (bool, error)

func (*DALTx) HasOnChainBalance

func (dtx *DALTx) HasOnChainBalance(cid ctype.CidType) (bool, error)

func (*DALTx) HasOpenChannelTs

func (dtx *DALTx) HasOpenChannelTs(peerAddr ctype.Addr, tokenAddr ctype.Addr) (bool, error)

func (*DALTx) HasPayEgressState

func (dtx *DALTx) HasPayEgressState(payID ctype.PayIDType) (bool, error)

func (*DALTx) HasPayIngressState

func (dtx *DALTx) HasPayIngressState(payID ctype.PayIDType) (bool, error)

func (*DALTx) HasPeer

func (dtx *DALTx) HasPeer(cid ctype.CidType) (bool, error)

func (*DALTx) HasPeerActiveChannels

func (dtx *DALTx) HasPeerActiveChannels(peer string) (bool, error)

func (*DALTx) HasRoute

func (dtx *DALTx) HasRoute(dest, tokenAddr string) (bool, error)

func (*DALTx) HasSecretRegistry

func (dtx *DALTx) HasSecretRegistry(hash string) (bool, error)

func (*DALTx) PutChannelMessage

func (dtx *DALTx) PutChannelMessage(cid ctype.CidType, seqnum uint64, msg *rpc.CelerMsg) error

func (*DALTx) PutChannelSeqNums

func (dtx *DALTx) PutChannelSeqNums(cid ctype.CidType, seqnums *common.ChannelSeqNums) error

func (*DALTx) PutChannelState

func (dtx *DALTx) PutChannelState(cid ctype.CidType, state string) error

func (*DALTx) PutCidForPeerAndToken

func (dtx *DALTx) PutCidForPeerAndToken(peer []byte, token *entity.TokenInfo, cid ctype.CidType) error

func (*DALTx) PutConditionalPay

func (dtx *DALTx) PutConditionalPay(payBytes []byte) error

func (*DALTx) PutCooperativeWithdrawJob

func (dtx *DALTx) PutCooperativeWithdrawJob(
	withdrawHash string, job *jobs.CooperativeWithdrawJob) error

func (*DALTx) PutDepositJob

func (dtx *DALTx) PutDepositJob(jobID string, job *jobs.DepositJob) error

func (*DALTx) PutDepositTxHashToJobID

func (dtx *DALTx) PutDepositTxHashToJobID(txHash string, jobID string) error

func (*DALTx) PutEventMonitorBit

func (dtx *DALTx) PutEventMonitorBit(eventName string) error

func (*DALTx) PutLastOpenChanReqBlkNum

func (dtx *DALTx) PutLastOpenChanReqBlkNum(peer []byte, token *entity.TokenInfo, blkNum int64) error

func (*DALTx) PutLogEventWatch

func (dtx *DALTx) PutLogEventWatch(name string, id *structs.LogEventID) error

func (*DALTx) PutOnChainBalance

func (dtx *DALTx) PutOnChainBalance(cid ctype.CidType, balance *structs.OnChainBalance) error

func (*DALTx) PutOpenChannelTs

func (dtx *DALTx) PutOpenChannelTs(peerAddr ctype.Addr, tokenAddr ctype.Addr, openChannelTs *openchannelts.OpenChannelTs) error

func (*DALTx) PutPayEgressState

func (dtx *DALTx) PutPayEgressState(payID ctype.PayIDType, cid ctype.CidType, status string) error

PutPayEgressState write pay egress cid, status for a given payID

func (*DALTx) PutPayIngressState

func (dtx *DALTx) PutPayIngressState(payID ctype.PayIDType, cid ctype.CidType, status string) error

PutPayIngressState write pay ingress cid, status for a given payID

func (*DALTx) PutPayNote

func (dtx *DALTx) PutPayNote(condPay *entity.ConditionalPay, note *any.Any) error

func (*DALTx) PutPeer

func (dtx *DALTx) PutPeer(cid ctype.CidType, peer string) error

func (*DALTx) PutPeerActiveChannels

func (dtx *DALTx) PutPeerActiveChannels(peer string, cids map[ctype.CidType]bool) error

func (*DALTx) PutRoute

func (dtx *DALTx) PutRoute(dest, tokenAddr string, nextHop ctype.CidType) error

func (*DALTx) PutSecretRegistry

func (dtx *DALTx) PutSecretRegistry(hash, preimage string) error

func (*DALTx) PutSimplexState

func (dtx *DALTx) PutSimplexState(cid ctype.CidType, owner string, simplexState *rpc.SignedSimplexState) error

func (*DALTx) PutTokenContractAddr

func (dtx *DALTx) PutTokenContractAddr(cid ctype.CidType, addr string) error

func (*DALTx) ScanAllCidsByPeer

func (dtx *DALTx) ScanAllCidsByPeer(peer []byte) []ctype.CidType

type KVStore

type KVStore interface {
	Close()
	OpenTransaction() (Transaction, error)
	Put(table, key string, value interface{}) error
	Get(table, key string, value interface{}) error
	Delete(table, key string) error
	Has(table, key string) (bool, error)
	GetKeysByPrefix(table, prefix string) ([]string, error)
}

KVStore is the interface implemented by the local store (LevelDB wrapper) and by the remote store (gRPC calls to a store server).

type KVStoreLocal

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

func NewKVStoreLocal

func NewKVStoreLocal(rootDir string, readOnly bool) (*KVStoreLocal, error)

Create a new local K/V store at the given root directory.

func (*KVStoreLocal) Close

func (s *KVStoreLocal) Close()

Close the local K/V store.

func (*KVStoreLocal) Delete

func (s *KVStoreLocal) Delete(table, key string) error

Delete the entry for a key within a table's namespace.

func (*KVStoreLocal) Get

func (s *KVStoreLocal) Get(table, key string, value interface{}) error

Extract the value of the given key within a table's namespace into the given variable.

func (*KVStoreLocal) GetKeysByPrefix

func (s *KVStoreLocal) GetKeysByPrefix(table, prefix string) ([]string, error)

Return all keys for a given table and key prefix. The key prefix can be the empty string, which returns all keys within the table.

func (*KVStoreLocal) Has

func (s *KVStoreLocal) Has(table, key string) (bool, error)

Check if an entry exists for the given key within a table's namespace.

func (*KVStoreLocal) OpenTransaction

func (s *KVStoreLocal) OpenTransaction() (Transaction, error)

Start a store transaction.

func (*KVStoreLocal) Put

func (s *KVStoreLocal) Put(table, key string, value interface{}) error

Store a key/value pair within a table's namespace.

type OnChainBalance

type OnChainBalance struct {
	MyDeposit         []byte
	MyWithdrawal      []byte
	PeerDeposit       []byte
	PeerWithdrawal    []byte
	PendingWithdrawal *PendingWithdrawal
}

DAL for on chain balances

type PayState

type PayState struct {
	Cid       ctype.CidType
	Status    string
	Timestamp int64
}

type PendingWithdrawal

type PendingWithdrawal struct {
	Amount   []byte
	Receiver ctype.Addr
	Deadline uint64
}

type Storage

type Storage interface {
	Put(table, key string, value interface{}) error
	Get(table, key string, value interface{}) error
	Delete(table, key string) error
	Has(table, key string) (bool, error)
	GetKeysByPrefix(table, prefix string) ([]string, error)
}

type Transaction

type Transaction interface {
	Commit() error
	Discard()
	ConvertError(err error) error
	Put(table, key string, value interface{}) error
	Get(table, key string, value interface{}) error
	Delete(table, key string) error
	Has(table, key string) (bool, error)
	GetKeysByPrefix(table, prefix string) ([]string, error)
}

Transaction is the interface implemented by the local and remote stores.

type TransactionLocal

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

func (*TransactionLocal) Commit

func (tx *TransactionLocal) Commit() error

Commit a transaction.

func (*TransactionLocal) ConvertError

func (tx *TransactionLocal) ConvertError(err error) error

func (*TransactionLocal) Delete

func (tx *TransactionLocal) Delete(table, key string) error

In a transaction, delete the entry for a key within a table's namespace.

func (*TransactionLocal) Discard

func (tx *TransactionLocal) Discard()

Discard a transaction.

func (*TransactionLocal) Get

func (tx *TransactionLocal) Get(table, key string, value interface{}) error

In a transaction, extract the value of the given key within a table's namespace into the given variable.

func (*TransactionLocal) GetKeysByPrefix

func (tx *TransactionLocal) GetKeysByPrefix(table, prefix string) ([]string, error)

In a transaction, return all keys for a given table and key prefix. The key prefix can be the empty string, which returns all keys within the table.

func (*TransactionLocal) Has

func (tx *TransactionLocal) Has(table, key string) (bool, error)

In a transaction, check if an entry exists for the given key within a table's namespace.

func (*TransactionLocal) Put

func (tx *TransactionLocal) Put(table, key string, value interface{}) error

In a transaction, store a key/value pair within a table's namespace.

type TxFunc

type TxFunc func(tx *DALTx, args ...interface{}) error

Jump to

Keyboard shortcuts

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