Documentation
¶
Index ¶
- Constants
- Variables
- func CalcAvgArtCost(dbtx *sql.Tx) (float64, int, error)
- func CalcPubFeeUSD(artCost, avgArtCost float64, artSize int, floPerKb, USDperFLO float64) (float64, float64)
- func CheckMediaMultipartComplete(reference string, dbtx *sql.Tx) ([]byte, string, error)
- func CheckPublisherAddressExists(address string, dbtx *sql.Tx) bool
- func CreateNewPublisherTxComment(b []byte)
- func CreateTables(dbTx *sql.Tx) error
- func DeactivateMedia(deactiv AlexandriaDeactivation, dbtx *sql.Tx) error
- func GetArtCount(dbtx *sql.Tx) (int, error)
- func HandleOIP041Edit(o Oip041, txid string, block int, dbtx *sql.Tx) error
- func StoreAutominer(am AlexandriaAutominer, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
- func StoreAutominerPool(amp AlexandriaAutominerPool, dbtx *sql.Tx, txid string, ...) error
- func StoreHistorianMessage(hm HistorianMessage, dbtx *sql.Tx, txid string, block *flojson.BlockResult)
- func StoreMedia(media AlexandriaMedia, jmap map[string]interface{}, dbtx *sql.Tx, txid string, ...)
- func StoreMediaMultipartSingle(mms MediaMultipartSingle, dbtx *sql.Tx)
- func StoreOIP041Artifact(o Oip041, txid string, block int, dbtx *sql.Tx) error
- func StoreOIP041Deactivate(o Oip041, dbtx *sql.Tx) error
- func StoreOIPTransfer(oip_t Oip041Transfer, dbtx *sql.Tx)
- func StorePromoter(pr AlexandriaPromoter, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
- func StorePromoterSocialMedia(pr []Promoter_SocialMedia, dbtx *sql.Tx, txid string, ...) error
- func StorePublisher(publisher AlexandriaPublisher, dbtx *sql.Tx, txid string, block int, ...)
- func StoreRetailer(ar AlexandriaRetailer, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
- func StoreRetailerOptionalFields(rof Retailer_OptionalFields, dbtx *sql.Tx, txid string, ...) error
- func UnSquashPatch(sp string) (error, string)
- func UpdateMediaMultipartSuccess(reference string, dbtx *sql.Tx)
- type AlexandriaAutominer
- type AlexandriaAutominerPool
- type AlexandriaDeactivation
- type AlexandriaMedia
- type AlexandriaPromoter
- type AlexandriaPublisher
- type AlexandriaRetailer
- type Autominer
- type AutominerPool
- type HistorianMessage
- type MediaMultipartSingle
- type Oip041
- type Oip041Address
- type Oip041Artifact
- type Oip041ArtifactAPIResult
- type Oip041Deactivate
- type Oip041Edit
- type Oip041Files
- type Oip041Info
- type Oip041MusicExtraInfo
- type Oip041Payment
- type Oip041Storage
- type Oip041Tokens
- type Oip041Transfer
- type Oip041Wrapper
- type Promoter
- type Promoter_SocialMedia
- type Promoter_SocialMedias
- type Retailer
- type Retailer_OptionalFields
Constants ¶
View Source
const AUTOMINER_POOL_ROOT_KEY = "alexandria-autominer-pool"
View Source
const AUTOMINER_ROOT_KEY = "alexandria-autominer"
View Source
const DEACTIVATION_ROOT_KEY = "alexandria-deactivation"
View Source
const PROMOTER_ROOT_KEY = "alexandria-promoter"
View Source
const PUBLISHER_ROOT_KEY = "alexandria-publisher"
View Source
const RETAILER_ROOT_KEY = "alexandria-retailer"
Variables ¶
View Source
var ErrBadSignature = errors.New("Bad signature")
View Source
var ErrHistorianMessageInvalid = errors.New("Historian message invalid")
View Source
var ErrHistorianMessagePoolUntrusted = errors.New("Historian message pool untrusted")
View Source
var ErrInvalidAddress = errors.New("Not a valid address")
View Source
var ErrInvalidReference = errors.New("Invalid reference transaction")
View Source
var ErrNoSignatureEnd = errors.New("no end of signature found, malformed tx-comment")
View Source
var ErrNotImplemented = errors.New("Not Implemented")
View Source
var ErrNotJSON = errors.New("Not a JSON string")
View Source
var ErrTooEarly = errors.New("Too early for a valid message")
View Source
var ErrWrongPrefix = errors.New("Wrong prefix for message type")
Functions ¶
func CalcPubFeeUSD ¶
func CreateNewPublisherTxComment ¶
func CreateNewPublisherTxComment(b []byte)
func CreateTables ¶
func DeactivateMedia ¶
func DeactivateMedia(deactiv AlexandriaDeactivation, dbtx *sql.Tx) error
func StoreAutominer ¶
func StoreAutominer(am AlexandriaAutominer, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
func StoreAutominerPool ¶
func StoreAutominerPool(amp AlexandriaAutominerPool, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
func StoreHistorianMessage ¶
func StoreHistorianMessage(hm HistorianMessage, dbtx *sql.Tx, txid string, block *flojson.BlockResult)
func StoreMedia ¶
func StoreMediaMultipartSingle ¶
func StoreMediaMultipartSingle(mms MediaMultipartSingle, dbtx *sql.Tx)
func StoreOIP041Artifact ¶
func StoreOIPTransfer ¶
func StoreOIPTransfer(oip_t Oip041Transfer, dbtx *sql.Tx)
func StorePromoter ¶
func StorePromoter(pr AlexandriaPromoter, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
func StorePromoterSocialMedia ¶
func StorePromoterSocialMedia(pr []Promoter_SocialMedia, dbtx *sql.Tx, txid string, block *flojson.BlockResult, id int64) error
func StorePublisher ¶
func StoreRetailer ¶
func StoreRetailer(ar AlexandriaRetailer, dbtx *sql.Tx, txid string, block *flojson.BlockResult) error
func StoreRetailerOptionalFields ¶
func StoreRetailerOptionalFields(rof Retailer_OptionalFields, dbtx *sql.Tx, txid string, block *flojson.BlockResult, id int64) error
func UnSquashPatch ¶
Types ¶
type AlexandriaAutominer ¶
type AlexandriaAutominer struct {
Autominer Autominer `json:"alexandria-autominer"`
Signature string `json:"signature"`
}
func VerifyAutominer ¶
func VerifyAutominer(b []byte, block int) (AlexandriaAutominer, error)
type AlexandriaAutominerPool ¶
type AlexandriaAutominerPool struct {
AutominerPool AutominerPool `json:"alexandria-autominer-pool"`
Signature string `json:"signature"`
}
func VerifyAutominerPool ¶
func VerifyAutominerPool(b []byte, block int) (AlexandriaAutominerPool, error)
Verify that the blockchain message is valid for autominer-pool
type AlexandriaDeactivation ¶
type AlexandriaDeactivation struct {
AlexandriaDeactivation struct {
// required txid and address fields
Txid string `json:"txid"`
Address string `json:"address"`
} `json:"alexandria-deactivation"`
Signature string `json:"signature"`
}
func VerifyDeactivation ¶
func VerifyDeactivation(b []byte) (AlexandriaDeactivation, error)
type AlexandriaMedia ¶
type AlexandriaMedia struct {
AlexandriaMedia struct {
// required media metadata
Torrent string `json:"torrent"`
Publisher string `json:"publisher"`
Timestamp int64 `json:"timestamp"`
Type string `json:"type"`
Info struct {
// required file information
Title string `json:"title"`
Description string `json:"description"`
Year int `json:"year"`
// optional extra-info field
ExtraInfo interface{} `json:"extra-info"`
} `json:"info"`
// optional fields
Payment interface{} `json:"payment"`
Extras string `json:"extras"`
} `json:"alexandria-media"`
ArtCost float64 `json:"artCost,omitempty"`
Signature string `json:"signature"`
}
func VerifyMedia ¶
func VerifyMedia(b []byte) (AlexandriaMedia, map[string]interface{}, error)
type AlexandriaPromoter ¶
type AlexandriaPromoter struct {
Promoter Promoter `json:"alexandria-promoter"`
Signature string `json:"signature"`
}
func VerifyPromoter ¶
func VerifyPromoter(b []byte, block int) (AlexandriaPromoter, error)
type AlexandriaPublisher ¶
type AlexandriaPublisher struct {
AlexandriaPublisher struct {
// required publisher metadata
Name string `json:"name"`
Address string `json:"address"`
Timestamp int64 `json:"timestamp"`
// optional fields
Emailmd5 string `json:"emailmd5"`
Bitmessage string `json:"bitmessage"`
ExtraInfo json.RawMessage `json:"extraInfo"`
} `json:"alexandria-publisher"`
Signature string `json:"signature"`
}
func VerifyPublisher ¶
func VerifyPublisher(b []byte) (AlexandriaPublisher, error)
type AlexandriaRetailer ¶
type AlexandriaRetailer struct {
Retailer Retailer `json:"alexandria-retailer"`
Signature string `json:"signature"`
}
func VerifyRetailer ¶
func VerifyRetailer(b []byte, block int) (AlexandriaRetailer, error)
type AutominerPool ¶
type HistorianMessage ¶
type HistorianMessage struct {
Version int
URL string
Mrr_last_10 float64
Mrr_last_24hr float64
Pool_hashrate float64
Fbd_hashrate float64
Fmd_weighted float64
Fmd_usd float64
Cmc_ltc float64
Signature string
}
func VerifyHistorianMessage ¶
type MediaMultipartSingle ¶
type MediaMultipartSingle struct {
Part int
Max int
Reference string
Address string
Signature string
Data string
Txid string
Block int
}
func VerifyMediaMultipartSingle ¶
func VerifyMediaMultipartSingle(s string, txid string, block int) (MediaMultipartSingle, error)
type Oip041 ¶
type Oip041 struct {
Artifact Oip041Artifact `json:"artifact"`
Edit Oip041Edit `json:"editArtifact"`
Deactivate Oip041Deactivate `json:"deactivateArtifact"`
Transfer Oip041Transfer `json:"transferArtifact"`
Signature string `json:"signature"`
// contains filtered or unexported fields
}
func DecodeOIP041 ¶
func VerifyOIP041Deactivate ¶
func VerifyOIP041Transfer ¶
func (Oip041) GetArtCost ¶
func (Oip041) MarshalJSON ¶
type Oip041Address ¶
type Oip041Artifact ¶
type Oip041Artifact struct {
Publisher string `json:"publisher"`
Timestamp int64 `json:"timestamp"`
Type string `json:"type"`
Info Oip041Info `json:"info"`
Storage Oip041Storage `json:"storage"`
Payment Oip041Payment `json:"payment"`
}
func (Oip041Artifact) CheckRequiredFields ¶
func (o Oip041Artifact) CheckRequiredFields() error
type Oip041ArtifactAPIResult ¶
type Oip041ArtifactAPIResult struct {
//OIP041 Oip041 `json:"oip-041,omitempty"`
Block int `json:"block,omitempty"`
Oip042 json.RawMessage `json:"oip042,omitempty"`
Tags string `json:"tags,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Title string `json:"title,omitempty"`
TxID string `json:"txid,omitempty"`
Type string `json:"type,omitempty"`
SubType string `json:"subType,omitempty"`
Year int `json:"year,omitempty"`
Publisher string `json:"publisher,omitempty"`
PublisherName string `json:"publisherName,omitempty"`
ArtCost float64 `json:"artCost,omitempty"`
ArtSize int `json:"artSize,omitempty"`
PubFeeUSD float64 `json:"pubFeeUSD,omitempty"`
NSFW bool `json:"nsfw,omitempty"`
}
func APIGetAllOIP041 ¶
func APIGetAllOIP041(dbtx *sql.Tx) ([]Oip041ArtifactAPIResult, error)
type Oip041Deactivate ¶
type Oip041Edit ¶
type Oip041Edit struct {
Patch json.RawMessage `json:"patch"`
Timestamp int64 `json:"timestamp"`
TxID string `json:"txid"`
}
type Oip041Files ¶
type Oip041Files struct {
DisallowBuy bool `json:"disBuy,omitempty"`
Dname string `json:"dname,omitempty"`
Duration float64 `json:"duration,omitempty"`
Fname string `json:"fname,omitempty"`
Fsize int64 `json:"fsize,omitempty"`
MinPlay float64 `json:"minPlay,omitempty"`
SugPlay float64 `json:"sugPlay,omitempty"`
Promo float64 `json:"promo,omitempty"`
Retail float64 `json:"retail,omitempty"`
PtpFT int `json:"ptpFT,omitempty"`
PtpDT int `json:"ptpDT,omitempty"`
PtpDA int `json:"ptpDA,omitempty"`
Type string `json:"type,omitempty"`
TokenlyID string `json:"tokenlyID,omitempty"`
DisallowPlay bool `json:"disPlay,omitempty"`
MinBuy float64 `json:"minBuy,omitempty"`
SugBuy float64 `json:"sugBuy,omitempty"`
SubType string `json:"subtype,omitempty"`
}
type Oip041Info ¶
type Oip041MusicExtraInfo ¶
type Oip041MusicExtraInfo struct {
Artist string `json:"artist"`
Company string `json:"company"`
Composers []string `json:"composers"`
Copyright string `json:"copyright"`
UsageProhibitions string `json:"usageProhibitions"`
UsageRights string `json:"usageRights"`
Genre string `json:"genre"`
Tags []string `json:"tags"`
ISRC string `json:"ISRC"`
}
type Oip041Payment ¶
type Oip041Payment struct {
Fiat string `json:"fiat"`
Scale string `json:"scale"`
SugTip []int `json:"sugTip"`
Tokens Oip041Tokens `json:"tokens"`
Addresses []Oip041Address `json:"addresses"`
Retailer int `json:"retailer"`
Promoter int `json:"promoter"`
MaxDiscount float64 `json:"maxdisc"`
}
type Oip041Storage ¶
type Oip041Storage struct {
Network string `json:"network,omitempty"`
Location string `json:"location,omitempty"`
Files []Oip041Files `json:"files"`
}
type Oip041Tokens ¶
type Oip041Transfer ¶
type Oip041Wrapper ¶
type Oip041Wrapper struct {
Oip041 Oip041 `json:"oip-041"`
}
type Promoter ¶
type Promoter struct {
FLOAddress string `json:"FLOaddress"`
BTCAddress string `json:"BTCaddress"`
Version int64 `json:"version"`
SocialMedia Promoter_SocialMedias `json:"social-media"`
}
func (Promoter) HasSocialMediaSequenceDuplicate ¶
check for duplicate Sequence numbers in Promoter_SocialMedia slice also, remember to check for duplicates before sorting TODO: make this better or implement a cap on social media networks
type Promoter_SocialMedia ¶
type Promoter_SocialMedias ¶
type Promoter_SocialMedias []Promoter_SocialMedia
func (Promoter_SocialMedias) Len ¶
func (slice Promoter_SocialMedias) Len() int
func (Promoter_SocialMedias) Less ¶
func (slice Promoter_SocialMedias) Less(i, j int) bool
func (Promoter_SocialMedias) Swap ¶
func (slice Promoter_SocialMedias) Swap(i, j int)
type Retailer ¶
type Retailer struct {
FLOAddress string `json:"FLOaddress"`
BTCAddress string `json:"BTCaddress"`
WebURL string `json:"web-url"`
Version int64 `json:"version"`
OptionalFields Retailer_OptionalFields `json:"optional-fields"`
}
type Retailer_OptionalFields ¶
type Retailer_OptionalFields struct {
Name string `json:"name"`
}
Click to show internal directories.
Click to hide internal directories.