arseeding

package module
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 56 Imported by: 0

README

Arseeding

Arseeding has been handed over to the Permadao community for development and maintenance.
To obtain the latest code, please visit repo.

Documentation

Index

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 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 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 added in v1.0.0

func (s *Arseeding) CalcItemFee(currency string, itemSize int64) (*schema.RespFee, error)

func (*Arseeding) DelItem added in v1.0.0

func (s *Arseeding) DelItem(itemId string) error

func (*Arseeding) FetchAndStoreTx added in v1.0.0

func (s *Arseeding) FetchAndStoreTx(arId string) (err error)

func (*Arseeding) GetBundlePerFees added in v1.0.0

func (s *Arseeding) GetBundlePerFees() (map[string]schema.Fee, error)

func (*Arseeding) GetPerFee added in v1.0.31

func (s *Arseeding) GetPerFee(tokenSymbol string) *schema.Fee

func (*Arseeding) ParseAndSaveBundleItems added in v1.0.0

func (s *Arseeding) ParseAndSaveBundleItems(arId string, data []byte) error

func (*Arseeding) ProcessSubmitItem added in v1.0.0

func (s *Arseeding) ProcessSubmitItem(item types.BundleItem, currency string, isNoFeeMode bool, apiKey string, isSort bool) (schema.Order, error)

func (*Arseeding) Run added in v1.0.0

func (s *Arseeding) Run(port string, bundleInterval int)

func (*Arseeding) SaveSubmitChunk added in v1.0.0

func (s *Arseeding) SaveSubmitChunk(chunk types.GetChunk) error

func (*Arseeding) SaveSubmitTx added in v1.0.0

func (s *Arseeding) SaveSubmitTx(arTx types.Transaction) error

func (*Arseeding) SetPerFee added in v1.0.31

func (s *Arseeding) SetPerFee(feeMap map[string]schema.Fee)

type Cache added in v1.0.0

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

func NewCache added in v1.0.0

func NewCache(arCli *goar.Client, peerMap map[string]int64) *Cache

func (*Cache) GetAnchor added in v1.0.0

func (c *Cache) GetAnchor() string

func (*Cache) GetConstTx added in v1.0.0

func (c *Cache) GetConstTx() *types.Transaction

func (*Cache) GetFee added in v1.0.0

func (c *Cache) GetFee() schema.ArFee

func (*Cache) GetInfo added in v1.0.0

func (c *Cache) GetInfo() types.NetworkInfo

func (*Cache) GetPeerMap added in v1.0.0

func (c *Cache) GetPeerMap() map[string]int64

func (*Cache) GetPeers added in v1.0.0

func (c *Cache) GetPeers() []string

func (*Cache) UpdateAnchor added in v1.0.0

func (c *Cache) UpdateAnchor(anchor string)

func (*Cache) UpdateFee added in v1.0.0

func (c *Cache) UpdateFee(price schema.ArFee)

func (*Cache) UpdateInfo added in v1.0.0

func (c *Cache) UpdateInfo(info types.NetworkInfo)

func (*Cache) UpdatePeers added in v1.0.0

func (c *Cache) UpdatePeers(peerMap map[string]int64)

type Store

type Store struct {
	KVDb rawdb.KeyValueDB
}

func NewAliyunStore added in v1.0.27

func NewAliyunStore(endpoint, accKey, secretKey, bucketPrefix string) (*Store, error)

func NewBoltStore added in v1.0.0

func NewBoltStore(boltDirPath string) (*Store, error)

func NewS3Store added in v1.0.0

func NewS3Store(accKey, secretKey, region, bucketPrefix, endpoint string) (*Store, error)

func (*Store) AtomicDelItem added in v1.0.0

func (s *Store) AtomicDelItem(itemId string) (err error)

func (*Store) AtomicSaveItem added in v1.0.0

func (s *Store) AtomicSaveItem(item types.BundleItem, itemId string, itemBinary []byte) (err error)

about bundle

func (*Store) AtomicSyncDataEndOffset added in v1.0.0

func (s *Store) AtomicSyncDataEndOffset(preEndOffset, newEndOffset uint64, dataRoot, dataSize string) error

func (*Store) Close

func (s *Store) Close() error

func (*Store) DelItemBinary added in v1.0.0

func (s *Store) DelItemBinary(itemId string) (err error)

func (*Store) DelItemMeta added in v1.0.0

func (s *Store) DelItemMeta(itemId string) (err error)

func (*Store) DelParsedBundleArId added in v1.0.0

func (s *Store) DelParsedBundleArId(arId string) error

func (*Store) DelPendingPoolTaskId added in v1.0.0

func (s *Store) DelPendingPoolTaskId(taskId string) error

func (*Store) ExistArIdToItemIds added in v1.0.0

func (s *Store) ExistArIdToItemIds(arId string) bool

func (*Store) IsExistChunk

func (s *Store) IsExistChunk(chunkStartOffset uint64) bool

func (*Store) IsExistItemBinary added in v1.0.0

func (s *Store) IsExistItemBinary(itemId string) bool

func (*Store) IsExistPeers added in v1.0.0

func (s *Store) IsExistPeers() bool

func (*Store) IsExistTxDataEndOffset

func (s *Store) IsExistTxDataEndOffset(dataRoot, dataSize string) bool

func (*Store) IsExistTxMeta

func (s *Store) IsExistTxMeta(arId string) bool

func (*Store) LoadAllDataEndOffset

func (s *Store) LoadAllDataEndOffset() (offset uint64)

func (*Store) LoadAllPendingTaskIds added in v1.0.0

func (s *Store) LoadAllPendingTaskIds() ([]string, error)

func (*Store) LoadArIdToItemIds added in v1.0.0

func (s *Store) LoadArIdToItemIds(arId string) (itemIds []string, err error)

func (*Store) LoadChunk

func (s *Store) LoadChunk(chunkStartOffset uint64) (chunk *types.GetChunk, err error)

func (*Store) LoadItemBinary added in v1.0.0

func (s *Store) LoadItemBinary(itemId string) (itemBinary []byte, err error)

func (*Store) LoadItemMeta added in v1.0.0

func (s *Store) LoadItemMeta(itemId string) (meta types.BundleItem, err error)

func (*Store) LoadPeers added in v1.0.0

func (s *Store) LoadPeers() (peers map[string]int64, err error)

func (*Store) LoadTask added in v1.0.0

func (s *Store) LoadTask(taskId string) (tk *schema.Task, err error)

func (*Store) LoadTxDataEndOffSet

func (s *Store) LoadTxDataEndOffSet(dataRoot, dataSize string) (txDataEndOffset uint64, err error)

func (*Store) LoadTxMeta

func (s *Store) LoadTxMeta(arId string) (arTx *types.Transaction, err error)

func (*Store) LoadWaitParseBundleArIds added in v1.0.0

func (s *Store) LoadWaitParseBundleArIds() (arIds []string, err error)

func (*Store) PutTaskPendingPool added in v1.0.0

func (s *Store) PutTaskPendingPool(taskId string) error

func (*Store) RollbackAllDataEndOffset added in v1.0.0

func (s *Store) RollbackAllDataEndOffset(preDataEndOffset uint64) (err error)

func (*Store) SaveAllDataEndOffset

func (s *Store) SaveAllDataEndOffset(allDataEndOffset uint64) (err error)

func (*Store) SaveArIdToItemIds added in v1.0.0

func (s *Store) SaveArIdToItemIds(arId string, itemIds []string) error

func (*Store) SaveChunk

func (s *Store) SaveChunk(chunkStartOffset uint64, chunk types.GetChunk) error

func (*Store) SaveItemBinary added in v1.0.0

func (s *Store) SaveItemBinary(itemId string, itemBinary []byte) (err error)

func (*Store) SaveItemMeta added in v1.0.0

func (s *Store) SaveItemMeta(item types.BundleItem) (err error)

func (*Store) SavePeers added in v1.0.0

func (s *Store) SavePeers(peers map[string]int64) error

func (*Store) SaveTask added in v1.0.0

func (s *Store) SaveTask(taskId string, tk schema.Task) error

func (*Store) SaveTxDataEndOffSet

func (s *Store) SaveTxDataEndOffSet(dataRoot, dataSize string, txDataEndOffset uint64) (err error)

func (*Store) SaveTxMeta

func (s *Store) SaveTxMeta(arTx types.Transaction) error

func (*Store) SaveWaitParseBundleArId added in v1.0.0

func (s *Store) SaveWaitParseBundleArId(arId string) error

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)