Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateArkAuthString(contractId uint64, nonce int64, signature []byte) string
- func GenerateMessageToSign(contractId uint64, nonce int64) string
- func NewTendermintClient(baseURL string) (*tmclient.HTTP, error)
- type ArkAuth
- type CORs
- type Claim
- type ClaimContractIncome
- type ClaimStore
- func (s *ClaimStore) Batch(items []Claim) error
- func (s *ClaimStore) Close() error
- func (s *ClaimStore) Get(key string) (item Claim, err error)
- func (s *ClaimStore) GetInternalDb() *leveldb.DB
- func (s *ClaimStore) Has(key string) (ok bool)
- func (s *ClaimStore) List() []Claim
- func (s *ClaimStore) Remove(key string) error
- func (s *ClaimStore) Set(item Claim) error
- type CloseContract
- type ContractAuth
- type ContractConfiguration
- type ContractConfigurationStore
- func (s *ContractConfigurationStore) Batch(items ContractConfigurations) error
- func (s *ContractConfigurationStore) Close() error
- func (s *ContractConfigurationStore) Get(id uint64) (item ContractConfiguration, err error)
- func (s *ContractConfigurationStore) GetInternalDb() *leveldb.DB
- func (s *ContractConfigurationStore) Has(id uint64) (ok bool)
- func (s *ContractConfigurationStore) List() ContractConfigurations
- func (s *ContractConfigurationStore) Remove(id uint64) error
- func (s *ContractConfigurationStore) Set(item ContractConfiguration) error
- type ContractConfigurations
- type MemStore
- func (k *MemStore) Get(key string) (types.Contract, error)
- func (k *MemStore) GetActiveContract(provider common.PubKey, service common.Service, spender common.PubKey) (types.Contract, error)
- func (k *MemStore) GetHeight() int64
- func (k *MemStore) Key(pubkey, service, spender string) string
- func (k *MemStore) Put(contract types.Contract)
- func (k *MemStore) SetHeight(height int64)
- type Metadata
- type ProviderBondEvent
- type ProviderConfiguration
- type ProviderConfigurationStore
- type ProviderModEvent
- type Proxy
Constants ¶
View Source
const ( QueryArkAuth = "arkauth" QueryContract = "arkcontract" ServiceHeader = "arkservice" )
View Source
const ( RoutesMetaData = "/metadata.json" RoutesActiveContract = "/active-contract/{service}/{spender}" RoutesClaim = "/claim/{id}" RoutesOpenClaims = "/open-claims" RouteManage = "/manage/contract/{id}" RouteProviderData = "/provider/{service}" )
Variables ¶
View Source
var ModuleBasics = module.NewBasicManager()
View Source
var Version = "0.0.0"
Functions ¶
func GenerateArkAuthString ¶
func GenerateMessageToSign ¶
Types ¶
type CORs ¶
type Claim ¶
type Claim struct { Provider common.PubKey `json:"provider"` ContractId uint64 `json:"contract_id"` Spender common.PubKey `json:"spender"` Nonce int64 `json:"nonce"` Signature string `json:"signature"` Claimed bool `json:"claimed"` }
type ClaimContractIncome ¶
type ClaimStore ¶
type ClaimStore struct {
// contains filtered or unexported fields
}
func NewClaimStore ¶
func NewClaimStore(levelDbFolder string) (*ClaimStore, error)
func (*ClaimStore) Batch ¶
func (s *ClaimStore) Batch(items []Claim) error
func (*ClaimStore) GetInternalDb ¶
func (s *ClaimStore) GetInternalDb() *leveldb.DB
func (*ClaimStore) Has ¶
func (s *ClaimStore) Has(key string) (ok bool)
Has check whether the given key exist in key value store
func (*ClaimStore) List ¶
func (s *ClaimStore) List() []Claim
List send back tx out to retry depending on arg failed only
func (*ClaimStore) Remove ¶
func (s *ClaimStore) Remove(key string) error
Remove remove the given item from key values store
func (*ClaimStore) Set ¶
func (s *ClaimStore) Set(item Claim) error
type CloseContract ¶
type ContractAuth ¶
func (ContractAuth) String ¶
func (auth ContractAuth) String() string
type ContractConfiguration ¶
type ContractConfiguration struct { ContractId uint64 `json:"contract_id"` LastTimeStamp int64 `json:"last_timestamp"` PerUserRateLimit int `json:"per_user_rate_limit"` CORs CORs `json:"cors"` WhitelistIPAddresses []string `json:"white_listed_ip_addresses"` }
func NewContractConfiguration ¶
func NewContractConfiguration(contractId uint64, cors CORs, ips []string, rateLimit int) ContractConfiguration
func (ContractConfiguration) Key ¶
func (c ContractConfiguration) Key() string
type ContractConfigurationStore ¶
type ContractConfigurationStore struct {
// contains filtered or unexported fields
}
func NewContractConfigurationStore ¶
func NewContractConfigurationStore(levelDbFolder string) (*ContractConfigurationStore, error)
func (*ContractConfigurationStore) Batch ¶
func (s *ContractConfigurationStore) Batch(items ContractConfigurations) error
func (*ContractConfigurationStore) Close ¶
func (s *ContractConfigurationStore) Close() error
Close underlying db
func (*ContractConfigurationStore) Get ¶
func (s *ContractConfigurationStore) Get(id uint64) (item ContractConfiguration, err error)
func (*ContractConfigurationStore) GetInternalDb ¶
func (s *ContractConfigurationStore) GetInternalDb() *leveldb.DB
func (*ContractConfigurationStore) Has ¶
func (s *ContractConfigurationStore) Has(id uint64) (ok bool)
Has check whether the given key exist in key value store
func (*ContractConfigurationStore) List ¶
func (s *ContractConfigurationStore) List() ContractConfigurations
List send back tx out to retry depending on arg failed only
func (*ContractConfigurationStore) Remove ¶
func (s *ContractConfigurationStore) Remove(id uint64) error
Remove remove the given item from key values store
func (*ContractConfigurationStore) Set ¶
func (s *ContractConfigurationStore) Set(item ContractConfiguration) error
type ContractConfigurations ¶
type ContractConfigurations []ContractConfiguration
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
TODO: this should receive events from arkeo chain to update its database TODO: clean up contracts from memory after they expire
func (*MemStore) GetActiveContract ¶
type Metadata ¶
type Metadata struct { Configuration conf.Configuration `json:"config"` Version string `json:"version"` }
func NewMetadata ¶
func NewMetadata(config conf.Configuration) Metadata
type ProviderBondEvent ¶
type ProviderConfiguration ¶
type ProviderConfiguration struct { PubKey common.PubKey `json:"pubkey,omitempty"` Service common.Service `json:"service,omitempty"` Bond cosmos.Int `json:"bond,omitempty"` BondRelative cosmos.Int `json:"bond_relative,omitempty"` MetadataUri string `json:"metadata_uri,omitempty"` MetadataNonce uint64 `json:"metadata_nonce,omitempty"` Status types.ProviderStatus `json:"status,omitempty"` MinContractDuration int64 `json:"min_contract_duration,omitempty"` MaxContractDuration int64 `json:"max_contract_duration,omitempty"` SubscriptionRate cosmos.Coins `json:"subscription_rate"` PayAsYouGoRate cosmos.Coins `json:"pay_as_you_go_rate"` SettlementDuration int64 `json:"settlement_duration,omitempty"` }
type ProviderConfigurationStore ¶
type ProviderConfigurationStore struct {
// contains filtered or unexported fields
}
func NewProviderConfigurationStore ¶
func NewProviderConfigurationStore(levelDbFolder string) (*ProviderConfigurationStore, error)
func (*ProviderConfigurationStore) Get ¶
func (ps *ProviderConfigurationStore) Get(pubKey common.PubKey, service string) (ProviderConfiguration, error)
GetProviderModOrBondConfig retrieves a ProviderConfiguration by its PubKey
func (*ProviderConfigurationStore) Remove ¶
func (p *ProviderConfigurationStore) Remove(pubKey common.PubKey, service string) error
func (*ProviderConfigurationStore) Set ¶
func (ps *ProviderConfigurationStore) Set(config ProviderConfiguration) error
SetProviderModOrBondConfig saves or updates a ProviderConfiguration in the database
type ProviderModEvent ¶
type Proxy ¶
type Proxy struct { Metadata Metadata Config conf.Configuration MemStore *MemStore ClaimStore *ClaimStore ContractConfigStore *ContractConfigurationStore ProviderConfigStore *ProviderConfigurationStore // contains filtered or unexported fields }
func (Proxy) EventListener ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.