schema

package
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: 5 Imported by: 5

Documentation

Index

Constants

View Source
const (
	AllowMaxItemSize       = 500 * 1024 * 1024 // 500 MB
	AllowMaxNativeDataSize = 500 * 1024 * 1024 // 500 MB
	AllowMaxRespDataSize   = 500 * 1024 * 1024 // 500 MB
)
View Source
const (
	DefaultPaymentExpiredRange = int64(86400) // 24 hour
	DefaultExpectedRange       = 50           // block height range
)
View Source
const (
	WaitOnChain    = "waiting"
	PendingOnChain = "pending"
	SuccOnChain    = "success"
	FailedOnChain  = "failed"

	// order payment status
	UnPayment      = "unpaid"
	SuccPayment    = "paid"
	ExpiredPayment = "expired"

	// ReceiptEverTx Status
	UnSpent   = "unspent"
	Spent     = "spent"
	UnRefund  = "unrefund"
	Refund    = "refunded"
	RefundErr = "refundErr"

	MaxPerOnChainSize = 500 * 1024 * 1024 // 500 MB
)
View Source
const (
	ManifestType = "application/x.arweave-manifest+json"
	ContentType  = "Content-Type"
	ManiData     = `` /* 652-byte string literal not displayed */

)
View Source
const (
	TaskTypeBroadcast     = "broadcast"      // include tx and tx data
	TaskTypeBroadcastMeta = "broadcast_meta" //  not include tx data
	TaskTypeSync          = "sync"
)
View Source
const (
	ConstTx = `` /* 1866-byte string literal not displayed */

)

Variables

View Source
var (
	ErrNotExist = errors.New("not_exist_record")
	ErrNotFound = errors.New("not_found")
	ErrExist    = errors.New("s3_bucket_exist")

	ErrExistTx    = errors.New("tx_exist")
	ErrTaskClosed = errors.New("task_closed")
	ErrFetchData  = errors.New("fetch_tx_data_from_peers")

	ErrDataTooBig    = errors.New("tx_data_too_big")
	ErrNullData      = errors.New("null_data")
	ErrLocalNotExist = errors.New("not_exist_local") // need to get data from gateway
	ErrPageNotFound  = errors.New("page_not_found")  // e.g manifest data not contain index path
)
View Source
var (
	// bucket
	ChunkBucket           = "chunk-bucket"              // key: chunkStartOffset, val: chunk
	TxDataEndOffSetBucket = "tx-data-end-offset-bucket" // key: dataRoot+dataSize; val: txDataEndOffSet
	TxMetaBucket          = "tx-meta-bucket"            // key: txId, val: arTx; not include data
	ConstantsBucket       = "constants-bucket"

	// tasks
	TaskIdPendingPoolBucket = "task-pending-pool-bucket" // key: taskId(taskType+"-"+arId), val: "0x01"
	TaskBucket              = "task-bucket"              // key: taskId(taskType+"-"+arId), val: task

	// bundle bucketName
	BundleItemBinary = "bundle-item-binary"
	BundleItemMeta   = "bundle-item-meta"

	// parse arTx data to bundle items
	BundleWaitParseArIdBucket = "bundle-wait-parse-arId-bucket" // key: arId, val: "0x01"
	BundleArIdToItemIdsBucket = "bundle-arId-to-itemIds-bucket" // key: arId, val: json.marshal(itemIds)

)

Functions

This section is empty.

Types

type ArFee

type ArFee struct {
	Base     int64
	PerChunk int64
}

type AutoApiKey added in v1.0.31

type AutoApiKey struct {
	ID        uint      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`

	ApiKey       string `gorm:"index:apikey01,unique"`
	EncryptedKey string

	Address      string `gorm:"index:apikey02,unique"`
	PubKey       string
	TokenBalance datatypes.JSONMap // key: symbol,val: balance
}

type Fee

type Fee struct {
	Currency string          `json:"currency"`
	Decimals int             `json:"decimals"`
	Base     decimal.Decimal `json:"base"`
	PerChunk decimal.Decimal `json:"perChunk"`
}

type IndexPath added in v1.0.8

type IndexPath struct {
	Path string `json:"path"`
}

type Manifest added in v1.0.13

type Manifest struct {
	ID          uint   `gorm:"primarykey" json:"-"`
	ManifestUrl string `gorm:"index:idxMani0,unique" json:"manifestUrl"`
	ManifestId  string `json:"manifestId"` // arId
}

type ManifestData added in v1.0.8

type ManifestData struct {
	Manifest string              `json:"manifest"` // must be "arweave/paths"
	Version  string              `json:"version"`  // currently "0.1.0"
	Index    IndexPath           `json:"index"`
	Paths    map[string]Resource `json:"paths"`
}

type OnChainTx

type OnChainTx struct {
	gorm.Model
	ArId      string
	CurHeight int64
	DataSize  string
	Reward    string         // onchain arTx reward
	Status    string         // "pending","success"
	ItemIds   datatypes.JSON // json.marshal(itemIds)
	ItemNum   int
}

type Order

type Order struct {
	ID        uint      `gorm:"primarykey" json:"id"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`

	ItemId   string `gorm:"index:idx0" json:"itemId"` // bundleItem id
	Signer   string `gorm:"index:idx1" json:"signer"` // item signer
	SignType int    `json:"signType"`

	Size               int64  `json:"size"`
	Currency           string `json:"currency"` // payment token symbol
	Decimals           int    `json:"decimals"`
	Fee                string `json:"fee"`
	PaymentExpiredTime int64  `json:"paymentExpiredTime"` // uint s
	ExpectedBlock      int64  `json:"expectedBlock"`

	PaymentStatus string `gorm:"index:idx0" json:"paymentStatus"` // "unpaid", "paid", "expired"
	PaymentId     string `json:"paymentId"`                       // everHash

	OnChainStatus string `gorm:"index:idx5" json:"onChainStatus"` // "waiting","pending","success","failed"
	ApiKey        string `gorm:"index:idx2" json:"-"`
	Sort          bool   `json:"sort"` // upload items to arweave by sequence
}

type PeerCount

type PeerCount struct {
	Peer  string
	Count int64
}

type ReceiptEverTx

type ReceiptEverTx struct {
	RawId    uint64 `grom:"primarykey"` // everTx rawId
	EverHash string `gorm:"unique"`
	Nonce    int64  // ms
	Symbol   string
	From     string
	Amount   string
	Data     string
	Sig      string

	Status string //  "unspent","spent", "unrefund", "refund"
	ErrMsg string
}

type ResBundler

type ResBundler struct {
	Bundler string `json:"bundler"`
}

type Resource added in v1.0.8

type Resource struct {
	TxId string `json:"id"`
}

type RespApiKey added in v1.0.31

type RespApiKey struct {
	// EncryptedKey string                 `json:"encryptedKey"`
	EstimateCap  string                 `json:"estimateCap"`
	TokenBalance map[string]interface{} `json:"tokenBalance"`
}

type RespErr

type RespErr struct {
	Err string `json:"error"`
}

func (RespErr) Error

func (r RespErr) Error() string

type RespFee

type RespFee struct {
	Currency string `json:"currency"`
	Decimals int    `json:"decimals"`
	FinalFee string `json:"finalFee"` // uint
}

type RespItemId added in v1.0.7

type RespItemId struct {
	ItemId string `json:"itemId"` // bundleItem id
	Size   int64  `json:"size"`
}

type RespOrder

type RespOrder struct {
	ItemId             string `json:"itemId"` // bundleItem id
	Size               int64  `json:"size"`
	Bundler            string `json:"bundler"`  // fee receiver address
	Currency           string `json:"currency"` // payment token symbol
	Decimals           int    `json:"decimals"`
	Fee                string `json:"fee"`
	PaymentExpiredTime int64  `json:"paymentExpiredTime"`
	ExpectedBlock      int64  `json:"expectedBlock"`
}

type Task

type Task struct {
	ArId           string `json:"arId"`
	TaskType       string `json:"taskType"`
	CountSuccessed int64  `json:"countSuccessed"`
	CountFailed    int64  `json:"countFailed"`
	TotalPeer      int    `json:"totalPeer"`
	Timestamp      int64  `json:"timestamp"` // begin timestamp
	Close          bool   `json:"close"`
}

type TokenPrice

type TokenPrice struct {
	Symbol    string `gorm:"primarykey"` // token symbol
	Decimals  int
	Price     float64 // unit is USD
	ManualSet bool    // manual set
	UpdatedAt time.Time
}

Jump to

Keyboard shortcuts

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