Documentation
¶
Index ¶
- Constants
- Variables
- func CORSMiddleware() gin.HandlerFunc
- func LimiterMiddleware(limit int, period string, ipRateWhitelist *map[string]struct{}) gin.HandlerFunc
- func ManifestMiddleware(wdb *Wdb, store *Store) gin.HandlerFunc
- type Arseeding
- func (s *Arseeding) CalcItemFee(currency string, itemSize int64) (*schema.RespFee, error)
- func (s *Arseeding) DelItem(itemId string) error
- func (s *Arseeding) FetchAndStoreTx(arId string) (err error)
- func (s *Arseeding) GetBundlePerFees() (map[string]schema.Fee, error)
- func (s *Arseeding) GetPerFee(tokenSymbol string) *schema.Fee
- func (s *Arseeding) ParseAndSaveBundleItems(arId string, data []byte) error
- func (s *Arseeding) ProcessSubmitItem(item types.BundleItem, currency string, isNoFeeMode bool, apiKey string, ...) (schema.Order, error)
- func (s *Arseeding) Run(port string, bundleInterval int)
- func (s *Arseeding) SaveSubmitChunk(chunk types.GetChunk) error
- func (s *Arseeding) SaveSubmitTx(arTx types.Transaction) error
- func (s *Arseeding) SetPerFee(feeMap map[string]schema.Fee)
- type Cache
- func (c *Cache) GetAnchor() string
- func (c *Cache) GetConstTx() *types.Transaction
- func (c *Cache) GetFee() schema.ArFee
- func (c *Cache) GetInfo() types.NetworkInfo
- func (c *Cache) GetPeerMap() map[string]int64
- func (c *Cache) GetPeers() []string
- func (c *Cache) UpdateAnchor(anchor string)
- func (c *Cache) UpdateFee(price schema.ArFee)
- func (c *Cache) UpdateInfo(info types.NetworkInfo)
- func (c *Cache) UpdatePeers(peerMap map[string]int64)
- type Store
- func (s *Store) AtomicDelItem(itemId string) (err error)
- func (s *Store) AtomicSaveItem(item types.BundleItem) (err error)
- func (s *Store) AtomicSyncDataEndOffset(preEndOffset, newEndOffset uint64, dataRoot, dataSize string) error
- func (s *Store) Close() error
- func (s *Store) DelItemBinary(itemId string) (err error)
- func (s *Store) DelItemMeta(itemId string) (err error)
- func (s *Store) DelParsedBundleArId(arId string) error
- func (s *Store) DelPendingPoolTaskId(taskId string) error
- func (s *Store) ExistArIdToItemIds(arId string) bool
- func (s *Store) IsExistChunk(chunkStartOffset uint64) bool
- func (s *Store) IsExistItemBinary(itemId string) bool
- func (s *Store) IsExistPeers() bool
- func (s *Store) IsExistTxDataEndOffset(dataRoot, dataSize string) bool
- func (s *Store) IsExistTxMeta(arId string) bool
- func (s *Store) LoadAllDataEndOffset() (offset uint64)
- func (s *Store) LoadAllPendingTaskIds() ([]string, error)
- func (s *Store) LoadArIdToItemIds(arId string) (itemIds []string, err error)
- func (s *Store) LoadChunk(chunkStartOffset uint64) (chunk *types.GetChunk, err error)
- func (s *Store) LoadItemBinary(itemId string) (binaryReader *os.File, itemBinary []byte, err error)
- func (s *Store) LoadItemMeta(itemId string) (meta types.BundleItem, err error)
- func (s *Store) LoadPeers() (peers map[string]int64, err error)
- func (s *Store) LoadTask(taskId string) (tk *schema.Task, err error)
- func (s *Store) LoadTxDataEndOffSet(dataRoot, dataSize string) (txDataEndOffset uint64, err error)
- func (s *Store) LoadTxMeta(arId string) (arTx *types.Transaction, err error)
- func (s *Store) LoadWaitParseBundleArIds() (arIds []string, err error)
- func (s *Store) PutTaskPendingPool(taskId string) error
- func (s *Store) RollbackAllDataEndOffset(preDataEndOffset uint64) (err error)
- func (s *Store) SaveAllDataEndOffset(allDataEndOffset uint64) (err error)
- func (s *Store) SaveArIdToItemIds(arId string, itemIds []string) error
- func (s *Store) SaveChunk(chunkStartOffset uint64, chunk types.GetChunk) error
- func (s *Store) SaveItemBinary(item types.BundleItem) (err error)
- func (s *Store) SaveItemMeta(item types.BundleItem) (err error)
- func (s *Store) SavePeers(peers map[string]int64) error
- func (s *Store) SaveTask(taskId string, tk schema.Task) error
- func (s *Store) SaveTxDataEndOffSet(dataRoot, dataSize string, txDataEndOffset uint64) (err error)
- func (s *Store) SaveTxMeta(arTx types.Transaction) error
- func (s *Store) SaveWaitParseBundleArId(arId string) error
- type TaskManager
- func (m *TaskManager) AddTask(arid, taskType string)
- func (m *TaskManager) BroadcastData(arId, taskType string, tx *types.Transaction, peers []string, txPosted bool)
- func (m *TaskManager) BroadcastTxMeta(arId, taskType string, tx *types.Transaction, peers []string)
- func (m *TaskManager) CloseTask(arid, taskType string) error
- func (m *TaskManager) DelTask(arid, taskType string)
- func (m *TaskManager) GetTask(arid, taskType string) *schema.Task
- func (m *TaskManager) GetTasks() (tasks map[string]schema.Task)
- func (m *TaskManager) GetTxDataFromPeers(arId, taskType string, peers []string) ([]byte, error)
- func (m *TaskManager) GetUnconfirmedTxFromPeers(arId, taskType string, peers []string) (*types.Transaction, error)
- func (m *TaskManager) IncFailed(arid, taskType string)
- func (m *TaskManager) IncSuccessed(arid, taskType string)
- func (m *TaskManager) InitTaskMg(boltDb *Store) error
- func (m *TaskManager) IsClosed(arid, taskType string) bool
- func (m *TaskManager) PopTkChan() <-chan string
- func (m *TaskManager) PutToTkChan(arId, taskType string)
- func (m *TaskManager) TaskBeginSet(arid, taskType string, totalPeer int) error
- type Wdb
- func (w *Wdb) DelManifest(id string) error
- func (w *Wdb) ExistApikey(addr string) (bool, schema.AutoApiKey)
- func (w *Wdb) ExistPaidOrd(itemId string) bool
- func (w *Wdb) ExistProcessedOrderItem(itemId string) (res schema.Order, exist bool)
- func (w *Wdb) GetApiKeyDetail(key string) (schema.AutoApiKey, error)
- func (w *Wdb) GetApiKeyDetailByAddress(addr string) (res schema.AutoApiKey, err error)
- func (w *Wdb) GetArPrice() (float64, error)
- func (w *Wdb) GetArTxByStatus(status string) ([]schema.OnChainTx, error)
- func (w *Wdb) GetExpiredOrders() ([]schema.Order, error)
- func (w *Wdb) GetLastEverRawId() (uint64, error)
- func (w *Wdb) GetManifestId(mfUrl string) (string, error)
- func (w *Wdb) GetNeedOnChainOrders() ([]schema.Order, error)
- func (w *Wdb) GetNeedOnChainOrdersSorted() ([]schema.Order, error)
- func (w *Wdb) GetOrdersByApiKey(apiKey string, cursorId int64, pageSize int, sort string) ([]schema.Order, error)
- func (w *Wdb) GetOrdersBySigner(signer string, cursorId int64, num int) ([]schema.Order, error)
- func (w *Wdb) GetPrices() ([]schema.TokenPrice, error)
- func (w *Wdb) GetReceiptsByStatus(status string) ([]schema.ReceiptEverTx, error)
- func (w *Wdb) GetUnPaidOrder(itemId string) (schema.Order, error)
- func (w *Wdb) InsertApiKey(ak schema.AutoApiKey) error
- func (w *Wdb) InsertArTx(tx schema.OnChainTx) error
- func (w *Wdb) InsertManifest(mf schema.Manifest) error
- func (w *Wdb) InsertOrder(order schema.Order) error
- func (w *Wdb) InsertPrices(tps []schema.TokenPrice) error
- func (w *Wdb) InsertReceiptTx(tx schema.ReceiptEverTx) error
- func (w *Wdb) IsLatestUnpaidOrd(itemId string, CurExpiredTime int64) bool
- func (w *Wdb) Migrate(noFee, enableManifest bool) error
- func (w *Wdb) UpdateApikeyTokenBal(addr string, newTokBal datatypes.JSONMap) error
- func (w *Wdb) UpdateArTx(id uint, arId string, curHeight int64, dataSize, reward string, status string) error
- func (w *Wdb) UpdateArTxStatus(arId, status string, tx *gorm.DB) error
- func (w *Wdb) UpdateOrdOnChainStatus(itemId, status string, tx *gorm.DB) error
- func (w *Wdb) UpdateOrdToExpiredStatus(id uint) error
- func (w *Wdb) UpdateOrderPay(id uint, everHash string, paymentStatus string, tx *gorm.DB) error
- func (w *Wdb) UpdatePrice(symbol string, newPrice float64) error
- func (w *Wdb) UpdateReceiptStatus(rawId uint64, status string, tx *gorm.DB) error
- func (w *Wdb) UpdateRefundErr(rawId uint64, errMsg string) error
Constants ¶
View Source
const ( ItemPaymentAction = "payment" ApikeyPaymentAction = "apikeyPayment" )
View Source
const (
MetricNameSpace = "arseeding"
)
Variables ¶
View Source
var ( ERR_TOO_MANY_REQUESTS = errors.New("err_limit_exceeded") MANIFEST_ID_NOT_FOUND = errors.New("err_manifest_id_not_found") )
Functions ¶
func CORSMiddleware ¶
func CORSMiddleware() gin.HandlerFunc
func LimiterMiddleware ¶
func LimiterMiddleware(limit int, period string, ipRateWhitelist *map[string]struct{}) gin.HandlerFunc
LimiterMiddleware period: "S"<Second>,"M"<Minute>,"H"<Hour>,"D"<Day>; limit: limit frequency
func ManifestMiddleware ¶
func ManifestMiddleware(wdb *Wdb, store *Store) gin.HandlerFunc
Types ¶
type Arseeding ¶
type Arseeding struct { NoFee bool // if true, means no bundle fee; default false EnableManifest bool // contains filtered or unexported fields }
func New ¶
func New( boltDirPath, mySqlDsn string, sqliteDir string, useSqlite bool, arWalletKeyPath string, arNode, payUrl string, noFee bool, enableManifest bool, useS3 bool, s3AccKey, s3SecretKey, s3BucketPrefix, s3Region, s3Endpoint string, use4EVER bool, useAliyun bool, aliyunEndpoint, aliyunAccKey, aliyunSecretKey, aliyunPrefix string, port string, customTags []types.Tag, ) *Arseeding
func (*Arseeding) CalcItemFee ¶
func (*Arseeding) FetchAndStoreTx ¶
func (*Arseeding) GetBundlePerFees ¶
func (*Arseeding) ParseAndSaveBundleItems ¶
func (*Arseeding) ProcessSubmitItem ¶
func (*Arseeding) SaveSubmitTx ¶
func (s *Arseeding) SaveSubmitTx(arTx types.Transaction) error
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) GetConstTx ¶
func (c *Cache) GetConstTx() *types.Transaction
func (*Cache) GetInfo ¶
func (c *Cache) GetInfo() types.NetworkInfo
func (*Cache) GetPeerMap ¶
func (*Cache) UpdateAnchor ¶
func (*Cache) UpdateInfo ¶
func (c *Cache) UpdateInfo(info types.NetworkInfo)
func (*Cache) UpdatePeers ¶
type Store ¶
type Store struct {
KVDb rawdb.KeyValueDB
}
func NewAliyunStore ¶
func NewBoltStore ¶
func NewS3Store ¶
func (*Store) AtomicDelItem ¶
func (*Store) AtomicSaveItem ¶
func (s *Store) AtomicSaveItem(item types.BundleItem) (err error)
about bundle
func (*Store) AtomicSyncDataEndOffset ¶
func (*Store) DelItemBinary ¶
func (*Store) DelItemMeta ¶
func (*Store) DelParsedBundleArId ¶
func (*Store) DelPendingPoolTaskId ¶
func (*Store) ExistArIdToItemIds ¶
func (*Store) IsExistChunk ¶
func (*Store) IsExistItemBinary ¶
func (*Store) IsExistPeers ¶
func (*Store) IsExistTxDataEndOffset ¶
func (*Store) IsExistTxMeta ¶
func (*Store) LoadAllDataEndOffset ¶
func (*Store) LoadAllPendingTaskIds ¶
func (*Store) LoadArIdToItemIds ¶
func (*Store) LoadItemBinary ¶
func (*Store) LoadItemMeta ¶
func (s *Store) LoadItemMeta(itemId string) (meta types.BundleItem, err error)
func (*Store) LoadTxDataEndOffSet ¶
func (*Store) LoadTxMeta ¶
func (s *Store) LoadTxMeta(arId string) (arTx *types.Transaction, err error)
func (*Store) LoadWaitParseBundleArIds ¶
func (*Store) PutTaskPendingPool ¶
func (*Store) RollbackAllDataEndOffset ¶
func (*Store) SaveAllDataEndOffset ¶
func (*Store) SaveArIdToItemIds ¶
func (*Store) SaveItemBinary ¶
func (s *Store) SaveItemBinary(item types.BundleItem) (err error)
func (*Store) SaveItemMeta ¶
func (s *Store) SaveItemMeta(item types.BundleItem) (err error)
func (*Store) SaveTxDataEndOffSet ¶
func (*Store) SaveTxMeta ¶
func (s *Store) SaveTxMeta(arTx types.Transaction) error
func (*Store) SaveWaitParseBundleArId ¶
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
func NewTaskMg ¶
func NewTaskMg() *TaskManager
func (*TaskManager) AddTask ¶
func (m *TaskManager) AddTask(arid, taskType string)
func (*TaskManager) BroadcastData ¶
func (m *TaskManager) BroadcastData(arId, taskType string, tx *types.Transaction, peers []string, txPosted bool)
func (*TaskManager) BroadcastTxMeta ¶
func (m *TaskManager) BroadcastTxMeta(arId, taskType string, tx *types.Transaction, peers []string)
func (*TaskManager) CloseTask ¶
func (m *TaskManager) CloseTask(arid, taskType string) error
func (*TaskManager) DelTask ¶
func (m *TaskManager) DelTask(arid, taskType string)
func (*TaskManager) GetTxDataFromPeers ¶
func (m *TaskManager) GetTxDataFromPeers(arId, taskType string, peers []string) ([]byte, error)
func (*TaskManager) GetUnconfirmedTxFromPeers ¶
func (m *TaskManager) GetUnconfirmedTxFromPeers(arId, taskType string, peers []string) (*types.Transaction, error)
func (*TaskManager) IncFailed ¶
func (m *TaskManager) IncFailed(arid, taskType string)
func (*TaskManager) IncSuccessed ¶
func (m *TaskManager) IncSuccessed(arid, taskType string)
func (*TaskManager) InitTaskMg ¶
func (m *TaskManager) InitTaskMg(boltDb *Store) error
func (*TaskManager) IsClosed ¶
func (m *TaskManager) IsClosed(arid, taskType string) bool
func (*TaskManager) PopTkChan ¶
func (m *TaskManager) PopTkChan() <-chan string
func (*TaskManager) PutToTkChan ¶
func (m *TaskManager) PutToTkChan(arId, taskType string)
func (*TaskManager) TaskBeginSet ¶
func (m *TaskManager) TaskBeginSet(arid, taskType string, totalPeer int) error
type Wdb ¶
func NewMysqlDb ¶
func NewSqliteDb ¶
func (*Wdb) DelManifest ¶
func (*Wdb) ExistApikey ¶
func (w *Wdb) ExistApikey(addr string) (bool, schema.AutoApiKey)
func (*Wdb) ExistPaidOrd ¶
func (*Wdb) ExistProcessedOrderItem ¶
func (*Wdb) GetApiKeyDetail ¶
func (w *Wdb) GetApiKeyDetail(key string) (schema.AutoApiKey, error)
func (*Wdb) GetApiKeyDetailByAddress ¶
func (w *Wdb) GetApiKeyDetailByAddress(addr string) (res schema.AutoApiKey, err error)
func (*Wdb) GetArPrice ¶
func (*Wdb) GetArTxByStatus ¶
func (*Wdb) GetLastEverRawId ¶
func (*Wdb) GetNeedOnChainOrdersSorted ¶
func (*Wdb) GetOrdersByApiKey ¶
func (*Wdb) GetOrdersBySigner ¶
func (*Wdb) GetReceiptsByStatus ¶
func (w *Wdb) GetReceiptsByStatus(status string) ([]schema.ReceiptEverTx, error)
func (*Wdb) InsertApiKey ¶
func (w *Wdb) InsertApiKey(ak schema.AutoApiKey) error
func (*Wdb) InsertPrices ¶
func (w *Wdb) InsertPrices(tps []schema.TokenPrice) error
func (*Wdb) InsertReceiptTx ¶
func (w *Wdb) InsertReceiptTx(tx schema.ReceiptEverTx) error
func (*Wdb) IsLatestUnpaidOrd ¶
func (*Wdb) UpdateApikeyTokenBal ¶
func (*Wdb) UpdateArTx ¶
func (*Wdb) UpdateArTxStatus ¶
func (*Wdb) UpdateOrdOnChainStatus ¶
func (*Wdb) UpdateOrdToExpiredStatus ¶
func (*Wdb) UpdateOrderPay ¶
func (*Wdb) UpdateReceiptStatus ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.