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) 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
- 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, itemId string, itemBinary []byte) (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) (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(itemId string, itemBinary []byte) (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) ExistPaidOrd(itemId string) bool
- func (w *Wdb) ExistProcessedOrderItem(itemId string) (res schema.Order, exist bool)
- 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) 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) 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) 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 (
MetricNameSpace = "arseeding"
)
Variables ¶
View Source
var (
ERR_TOO_MANY_REQUESTS = errors.New("err_limit_exceeded")
)
Functions ¶
func CORSMiddleware ¶ added in v1.0.13
func CORSMiddleware() gin.HandlerFunc
func LimiterMiddleware ¶ added in v1.0.13
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 ¶ added in v1.0.13
func ManifestMiddleware(wdb *Wdb, store *Store) gin.HandlerFunc
Types ¶
type Arseeding ¶ added in v1.0.0
type Arseeding struct { NoFee bool // if true, means no bundle fee; default false EnableManifest bool // contains filtered or unexported fields }
func (*Arseeding) CalcItemFee ¶ added in v1.0.0
func (*Arseeding) FetchAndStoreTx ¶ added in v1.0.0
func (*Arseeding) GetBundlePerFees ¶ added in v1.0.0
func (*Arseeding) ParseAndSaveBundleItems ¶ added in v1.0.0
func (*Arseeding) ProcessSubmitItem ¶ added in v1.0.0
func (*Arseeding) SaveSubmitChunk ¶ added in v1.0.0
func (*Arseeding) SaveSubmitTx ¶ added in v1.0.0
func (s *Arseeding) SaveSubmitTx(arTx types.Transaction) error
type Cache ¶ added in v1.0.0
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) GetConstTx ¶ added in v1.0.0
func (c *Cache) GetConstTx() *types.Transaction
func (*Cache) GetInfo ¶ added in v1.0.0
func (c *Cache) GetInfo() types.NetworkInfo
func (*Cache) GetPeerMap ¶ added in v1.0.0
func (*Cache) UpdateAnchor ¶ added in v1.0.0
func (*Cache) UpdateInfo ¶ added in v1.0.0
func (c *Cache) UpdateInfo(info types.NetworkInfo)
func (*Cache) UpdatePeers ¶ added in v1.0.0
type Store ¶
type Store struct {
KVDb rawdb.KeyValueDB
}
func NewBoltStore ¶ added in v1.0.0
func NewS3Store ¶ added in v1.0.0
func (*Store) AtomicDelItem ¶ added in v1.0.0
func (*Store) AtomicSaveItem ¶ added in v1.0.0
about bundle
func (*Store) AtomicSyncDataEndOffset ¶ added in v1.0.0
func (*Store) DelItemBinary ¶ added in v1.0.0
func (*Store) DelItemMeta ¶ added in v1.0.0
func (*Store) DelParsedBundleArId ¶ added in v1.0.0
func (*Store) DelPendingPoolTaskId ¶ added in v1.0.0
func (*Store) ExistArIdToItemIds ¶ added in v1.0.0
func (*Store) IsExistChunk ¶
func (*Store) IsExistItemBinary ¶ added in v1.0.0
func (*Store) IsExistPeers ¶ added in v1.0.0
func (*Store) IsExistTxDataEndOffset ¶
func (*Store) IsExistTxMeta ¶
func (*Store) LoadAllDataEndOffset ¶
func (*Store) LoadAllPendingTaskIds ¶ added in v1.0.0
func (*Store) LoadArIdToItemIds ¶ added in v1.0.0
func (*Store) LoadItemBinary ¶ added in v1.0.0
func (*Store) LoadItemMeta ¶ added in v1.0.0
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 ¶ added in v1.0.0
func (*Store) PutTaskPendingPool ¶ added in v1.0.0
func (*Store) RollbackAllDataEndOffset ¶ added in v1.0.0
func (*Store) SaveAllDataEndOffset ¶
func (*Store) SaveArIdToItemIds ¶ added in v1.0.0
func (*Store) SaveItemBinary ¶ added in v1.0.0
func (*Store) SaveItemMeta ¶ added in v1.0.0
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 ¶ added in v1.0.0
type TaskManager ¶ added in v1.0.0
type TaskManager struct {
// contains filtered or unexported fields
}
func NewTaskMg ¶ added in v1.0.0
func NewTaskMg() *TaskManager
func (*TaskManager) AddTask ¶ added in v1.0.0
func (m *TaskManager) AddTask(arid, taskType string)
func (*TaskManager) BroadcastData ¶ added in v1.0.0
func (m *TaskManager) BroadcastData(arId, taskType string, tx *types.Transaction, peers []string, txPosted bool)
func (*TaskManager) BroadcastTxMeta ¶ added in v1.0.0
func (m *TaskManager) BroadcastTxMeta(arId, taskType string, tx *types.Transaction, peers []string)
func (*TaskManager) CloseTask ¶ added in v1.0.0
func (m *TaskManager) CloseTask(arid, taskType string) error
func (*TaskManager) DelTask ¶ added in v1.0.0
func (m *TaskManager) DelTask(arid, taskType string)
func (*TaskManager) GetTask ¶ added in v1.0.0
func (m *TaskManager) GetTask(arid, taskType string) *schema.Task
func (*TaskManager) GetTasks ¶ added in v1.0.0
func (m *TaskManager) GetTasks() (tasks map[string]schema.Task)
func (*TaskManager) GetTxDataFromPeers ¶ added in v1.0.0
func (m *TaskManager) GetTxDataFromPeers(arId, taskType string, peers []string) ([]byte, error)
func (*TaskManager) GetUnconfirmedTxFromPeers ¶ added in v1.0.0
func (m *TaskManager) GetUnconfirmedTxFromPeers(arId, taskType string, peers []string) (*types.Transaction, error)
func (*TaskManager) IncFailed ¶ added in v1.0.0
func (m *TaskManager) IncFailed(arid, taskType string)
func (*TaskManager) IncSuccessed ¶ added in v1.0.0
func (m *TaskManager) IncSuccessed(arid, taskType string)
func (*TaskManager) InitTaskMg ¶ added in v1.0.0
func (m *TaskManager) InitTaskMg(boltDb *Store) error
func (*TaskManager) IsClosed ¶ added in v1.0.0
func (m *TaskManager) IsClosed(arid, taskType string) bool
func (*TaskManager) PopTkChan ¶ added in v1.0.0
func (m *TaskManager) PopTkChan() <-chan string
func (*TaskManager) PutToTkChan ¶ added in v1.0.0
func (m *TaskManager) PutToTkChan(arId, taskType string)
func (*TaskManager) TaskBeginSet ¶ added in v1.0.0
func (m *TaskManager) TaskBeginSet(arid, taskType string, totalPeer int) error
type Wdb ¶ added in v1.0.0
func (*Wdb) DelManifest ¶ added in v1.0.18
func (*Wdb) ExistPaidOrd ¶ added in v1.0.15
func (*Wdb) ExistProcessedOrderItem ¶ added in v1.0.0
func (*Wdb) GetArPrice ¶ added in v1.0.0
func (*Wdb) GetArTxByStatus ¶ added in v1.0.0
func (*Wdb) GetExpiredOrders ¶ added in v1.0.0
func (*Wdb) GetLastEverRawId ¶ added in v1.0.0
func (*Wdb) GetManifestId ¶ added in v1.0.13
func (*Wdb) GetNeedOnChainOrders ¶ added in v1.0.0
func (*Wdb) GetOrdersByApiKey ¶ added in v1.0.7
func (*Wdb) GetOrdersBySigner ¶ added in v1.0.0
func (*Wdb) GetReceiptsByStatus ¶ added in v1.0.0
func (w *Wdb) GetReceiptsByStatus(status string) ([]schema.ReceiptEverTx, error)
func (*Wdb) GetUnPaidOrder ¶ added in v1.0.0
func (*Wdb) InsertManifest ¶ added in v1.0.13
func (*Wdb) InsertPrices ¶ added in v1.0.0
func (w *Wdb) InsertPrices(tps []schema.TokenPrice) error
func (*Wdb) InsertReceiptTx ¶ added in v1.0.0
func (w *Wdb) InsertReceiptTx(tx schema.ReceiptEverTx) error
func (*Wdb) IsLatestUnpaidOrd ¶ added in v1.0.15
func (*Wdb) UpdateArTx ¶ added in v1.0.0
func (*Wdb) UpdateArTxStatus ¶ added in v1.0.0
func (*Wdb) UpdateOrdOnChainStatus ¶ added in v1.0.0
func (*Wdb) UpdateOrdToExpiredStatus ¶ added in v1.0.0
func (*Wdb) UpdateOrderPay ¶ added in v1.0.0
func (*Wdb) UpdatePrice ¶ added in v1.0.0
func (*Wdb) UpdateReceiptStatus ¶ added in v1.0.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.