oip042

package
v0.0.0-...-358d922 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadSignature = errors.New("bad signature")
View Source
var ErrDescriptionMissing = errors.New("artifact missing description")
View Source
var ErrMissingOipAction = errors.New("missing oip action")
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var ErrTypeMissing = errors.New("artifact missing type")

Functions

func GetAllArtifacts

func GetAllArtifacts(dbtx *sqlx.Tx) ([]interface{}, error)

func GetAllPublishers

func GetAllPublishers(dbtx *sqlx.Tx) ([]interface{}, error)

func GetById

func GetById(dbh *sqlx.DB, artId string) (interface{}, error)

func GetByPublisher

func GetByPublisher(dbtx *sqlx.Tx, publisher string) ([]interface{}, error)

func GetByType

func GetByType(dbtx *sqlx.Tx, t string, st string, page uint64, results uint64, pub string) (interface{}, error)

func SetupTables

func SetupTables(dbtx *sqlx.Tx) error

Types

type ArtifactFiles

type ArtifactFiles struct {
	Software     string  `json:"software,omitempty"`
	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"`
	CType        string  `json:"cType,omitempty"`
	FNotes       string  `json:"fNotes,omitempty"`
}

type ArtifactInfo

type ArtifactInfo struct {
	Title       string `json:"title,omitempty"`
	Tags        string `json:"tags,omitempty"`
	Description string `json:"description,omitempty"`
	Year        int    `json:"year,omitempty"`
	NSFW        bool   `json:"nsfw,omitempty"`
}

type ArtifactPayment

type ArtifactPayment struct {
	Fiat        string          `json:"fiat,omitempty"`
	Scale       string          `json:"scale,omitempty"`
	SugTip      []int           `json:"sugTip,omitempty"`
	Tokens      *PaymentTokens  `json:"tokens,omitempty"`
	Addresses   *PaymentAddress `json:"addresses,omitempty"`
	Platform    int             `json:"platform,omitempty"`
	Influencer  int             `json:"influencer,omitempty"`
	MaxDiscount float64         `json:"maxdisc,omitempty"`
	ShortMW     []string        `json:"shortMW,omitempty"`
}

type ArtifactStorage

type ArtifactStorage struct {
	Network  string          `json:"network,omitempty"`
	Location string          `json:"location,omitempty"`
	Files    []ArtifactFiles `json:"files,omitempty"`
}

type AutominerInfo

type AutominerInfo struct {
	MinShare int32  `json:"minShare"`
	HttpUrl  string `json:"httpURL"`
}

type AutominerPoolInfo

type AutominerPoolInfo struct {
	PoolShare    int32  `json:"poolShare"`
	TargetMargin int32  `json:"targetMargin"`
	HttpUrl      string `json:"httpURL"`
}

type Deactivate

type Deactivate struct {
	Artifact *DeactivateArtifact `json:"artifact,omitempty"`
	Pub      *DeactivatePub      `json:"pub,omitempty"`
}

func (Deactivate) Validate

func (d Deactivate) Validate(ctx OipContext) (OipAction, error)

type DeactivateArtifact

type DeactivateArtifact struct {
	ArtifactID string `json:"artifactID"`
	Timestamp  int64  `json:"timestamp"`
	Signature  string `json:"signature"`
}

func (DeactivateArtifact) Store

func (da DeactivateArtifact) Store(context OipContext) error

func (DeactivateArtifact) Validate

func (da DeactivateArtifact) Validate(context OipContext) (OipAction, error)

type DeactivatePub

type DeactivatePub struct {
	FloAddress string `json:"address"`
	Timestamp  int64  `json:"timestamp"`
	Signature  string `json:"signature"`
}

func (DeactivatePub) Store

func (dp DeactivatePub) Store(context OipContext) error

func (DeactivatePub) Validate

func (dp DeactivatePub) Validate(context OipContext) (OipAction, error)

type DecimalDegrees

type DecimalDegrees struct {
}

type DegreesMinutesSeconds

type DegreesMinutesSeconds struct {
}

type Edit

type Edit struct {
	Pub           *EditPub           `json:"pub,omitempty"`
	Platform      *EditPlatform      `json:"platform,omitempty"`
	Influencer    *EditInfluencer    `json:"influencer,omitempty"`
	Autominer     *EditAutominer     `json:"autominer,omitempty"`
	AutominerPool *EditAutominerPool `json:"autominerPool,omitempty"`
	Artifact      *EditArtifact      `json:"artifact,omitempty"`
}

func (Edit) Validate

func (e Edit) Validate(ctx OipContext) (OipAction, error)

type EditArtifact

type EditArtifact struct {
	ArtifactID string          `json:"artifactID"`
	Timestamp  int64           `json:"timestamp"`
	RawPatch   json.RawMessage `json:"patch"`
	Patch      jsonpatch.Patch
	Signature  string `json:"signature"`
}

func (EditArtifact) Store

func (ea EditArtifact) Store(context OipContext) error

func (EditArtifact) Validate

func (ea EditArtifact) Validate(context OipContext) (OipAction, error)

type EditAutominer

type EditAutominer struct {
	ArtifactID string          `json:"artifactID"`
	Timestamp  int64           `json:"timestamp"`
	Patch      json.RawMessage `json:"patch"`
	Signature  string          `json:"signature"`
}

func (*EditAutominer) Store

func (autominer *EditAutominer) Store(context OipContext) error

func (*EditAutominer) Validate

func (autominer *EditAutominer) Validate(context OipContext) (OipAction, error)

type EditAutominerPool

type EditAutominerPool struct {
	ArtifactID string          `json:"artifactID"`
	Timestamp  int64           `json:"timestamp"`
	Patch      json.RawMessage `json:"patch"`
	Signature  string          `json:"signature"`
}

func (*EditAutominerPool) Store

func (autominerPool *EditAutominerPool) Store(context OipContext) error

func (*EditAutominerPool) Validate

func (autominerPool *EditAutominerPool) Validate(context OipContext) (OipAction, error)

type EditInfluencer

type EditInfluencer struct {
	ArtifactID string          `json:"artifactID"`
	Timestamp  int64           `json:"timestamp"`
	Patch      json.RawMessage `json:"patch"`
	Signature  string          `json:"signature"`
}

func (*EditInfluencer) Store

func (ei *EditInfluencer) Store(context OipContext) error

func (*EditInfluencer) Validate

func (ei *EditInfluencer) Validate(context OipContext) (OipAction, error)

type EditPlatform

type EditPlatform struct {
	ArtifactID string          `json:"artifactID"`
	Timestamp  int64           `json:"timestamp"`
	Patch      json.RawMessage `json:"patch"`
}

func (*EditPlatform) Store

func (platform *EditPlatform) Store(context OipContext) error

func (*EditPlatform) Validate

func (platform *EditPlatform) Validate(context OipContext) (OipAction, error)

type EditPub

type EditPub struct {
	Address   string          `json:"address"`
	Timestamp int64           `json:"timestamp"`
	Patch     json.RawMessage `json:"patch"`
	Signature string          `json:"signature"`
}

func (EditPub) Store

func (ep EditPub) Store(context OipContext) error

func (EditPub) Validate

func (ep EditPub) Validate(context OipContext) (OipAction, error)

type Geometry

type Geometry struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
	// contains filtered or unexported fields
}

type IOip042

type IOip042 interface {
	IOip042()
}

type Oip042

type Oip042 struct {
	Register   *Register   `json:"register,omitempty"`
	Publish    *Publish    `json:"publish,omitempty"`
	Edit       *Edit       `json:"edit,omitempty"`
	Deactivate *Deactivate `json:"deactivate,omitempty"`
	Transfer   *Transfer   `json:"transfer,omitempty"`
}

func (Oip042) ValidateIncoming

func (o Oip042) ValidateIncoming(tx *flojson.TxRawResult, txComment string, txid string, block *flojson.BlockResult, dbtx *sqlx.Tx) (OipAction, error)

type OipAction

type OipAction interface {
	Validate(context OipContext) (OipAction, error)
	Store(context OipContext) error
}

type OipContext

type OipContext struct {
	Tx          *flojson.TxRawResult
	TxComment   string
	TxId        string
	BlockHeight int64
	Block       *flojson.BlockResult
	DbTx        *sqlx.Tx
	IsEdit      bool
	Reference   string
	ArtifactId  int64
	IndexTypes  []string
}

type PartyDetails

type PartyDetails struct {
	Ns        string          `json:"ns,omitempty"`
	PartyRole string          `json:"partyRole,omitempty"`
	PartyType string          `json:"partyType,omitempty"`
	Tenures   []string        `json:"tenures,omitempty"`
	Groups    []string        `json:"groups,omitempty"`
	Members   []string        `json:"members,omitempty"`
	Attrs     json.RawMessage `json:"attrs,omitempty"`
}

type PaymentAddress

type PaymentAddress map[string]string

type PaymentTokens

type PaymentTokens map[string]int

type PlatformInfo

type PlatformInfo struct {
	MinShare int32  `json:"minShare"`
	HttpUrl  string `json:"httpURL"`
}

type Publish

type Publish struct {
	Artifact *PublishArtifact `json:"artifact,omitempty"`
}

func (Publish) Validate

func (p Publish) Validate(ctx OipContext) (OipAction, error)

type PublishArtifact

type PublishArtifact struct {
	FloAddress string           `json:"floAddress,omitempty"`
	Timestamp  int64            `json:"timestamp,omitempty"`
	Type       string           `json:"type,omitempty"`
	SubType    string           `json:"subtype,omitempty"`
	Info       *ArtifactInfo    `json:"info,omitempty"`
	Details    json.RawMessage  `json:"details,omitempty"`
	Storage    *ArtifactStorage `json:"storage,omitempty"`
	Payment    *ArtifactPayment `json:"payment,omitempty"`
	Signature  string           `json:"signature,omitempty"`
}

func (PublishArtifact) Store

func (pa PublishArtifact) Store(context OipContext) error

func (PublishArtifact) Validate

func (pa PublishArtifact) Validate(context OipContext) (OipAction, error)

type PublishPropertyParty

type PublishPropertyParty struct {
	PublishArtifact
	PartyDetails
}

func (PublishPropertyParty) MarshalJSON

func (ppp PublishPropertyParty) MarshalJSON() ([]byte, error)

func (PublishPropertyParty) Store

func (ppp PublishPropertyParty) Store(context OipContext) error

func (PublishPropertyParty) Validate

func (ppp PublishPropertyParty) Validate(context OipContext) (OipAction, error)

type PublishPropertySpatialUnit

type PublishPropertySpatialUnit struct {
	PublishArtifact
	SpatialUnitDetails
}

func (PublishPropertySpatialUnit) MarshalJSON

func (ppsu PublishPropertySpatialUnit) MarshalJSON() ([]byte, error)

func (PublishPropertySpatialUnit) Store

func (ppsu PublishPropertySpatialUnit) Store(context OipContext) error

func (PublishPropertySpatialUnit) Validate

func (ppsu PublishPropertySpatialUnit) Validate(context OipContext) (OipAction, error)

type PublishPropertyTenure

type PublishPropertyTenure struct {
	PublishArtifact
	TenureDetails
}

func (PublishPropertyTenure) MarshalJSON

func (ppt PublishPropertyTenure) MarshalJSON() ([]byte, error)

func (PublishPropertyTenure) Store

func (ppt PublishPropertyTenure) Store(context OipContext) error

func (PublishPropertyTenure) Validate

func (ppt PublishPropertyTenure) Validate(context OipContext) (OipAction, error)

type PublishTomogram

type PublishTomogram struct {
	PublishArtifact
	TomogramDetails
}

func (PublishTomogram) MarshalJSON

func (pt PublishTomogram) MarshalJSON() ([]byte, error)

func (PublishTomogram) Store

func (pt PublishTomogram) Store(context OipContext) error

func (PublishTomogram) Validate

func (pt PublishTomogram) Validate(context OipContext) (OipAction, error)

type PublisherInfo

type PublisherInfo struct {
	Emailmd5           string `json:"emailmd5,omitempty"`
	AvatarNetwork      string `json:"avatarNetwork,omitempty"`
	Avatar             string `json:"avatar,omitempty"`
	HeaderImageNetwork string `json:"headerImageNetwork,omitempty"`
	HeaderImage        string `json:"headerImage,omitempty"`
	Bitmessage         string `json:"bitmessage,omitempty"`
}

type PublisherVerification

type PublisherVerification struct {
	Imdb        string `json:"imdb,omitempty"`
	Musicbrainz string `json:"musicbrainz,omitempty"`
	Twitter     string `json:"twitter,omitempty"`
	Facebook    string `json:"facebook,omitempty"`
}

type Register

type Register struct {
	Pub           *RegisterPub           `json:"pub,omitempty"`
	Platform      *RegisterPlatform      `json:"platform,omitempty"`
	Influencer    *RegisterInfluencer    `json:"influencer,omitempty"`
	Autominer     *RegisterAutominer     `json:"autominer,omitempty"`
	AutominerPool *RegisterAutominerPool `json:"autominerPool,omitempty"`
}

func (Register) Validate

func (r Register) Validate(ctx OipContext) (OipAction, error)

type RegisterAutominer

type RegisterAutominer struct {
	Alias      string           `json:"alias"`
	Timestamp  int64            `json:"timestamp"`
	FloAddress string           `json:"floAddress"`
	Addresses  []PaymentAddress `json:"addresses"`
	ShortMW    []string         `json:"shortMW"`
	Version    int32            `json:"version"`
	Info       AutominerInfo    `json:"info"`
	Signature  string           `json:"signature"`
}

func (RegisterAutominer) Store

func (ram RegisterAutominer) Store(context OipContext) error

func (RegisterAutominer) Validate

func (ram RegisterAutominer) Validate(context OipContext) (OipAction, error)

type RegisterAutominerPool

type RegisterAutominerPool struct {
	Alias        string            `json:"alias"`
	Timestamp    int64             `json:"timestamp"`
	FloAddress   string            `json:"floAddress"`
	Addresses    []PaymentAddress  `json:"addresses"`
	ShortMW      []string          `json:"shortMW"`
	Verification map[string]string `json:"verification"`
	Version      int32             `json:"version"`
	Info         AutominerInfo     `json:"info"`
	Signature    string            `json:"signature"`
}

func (RegisterAutominerPool) Store

func (ramp RegisterAutominerPool) Store(context OipContext) error

func (RegisterAutominerPool) Validate

func (ramp RegisterAutominerPool) Validate(context OipContext) (OipAction, error)

type RegisterInfluencer

type RegisterInfluencer struct {
	Alias        string            `json:"alias"`
	Timestamp    int64             `json:"timestamp"`
	FloAddress   string            `json:"floAddress"`
	Addresses    []PaymentAddress  `json:"addresses"`
	ShortMW      []string          `json:"shortMW"`
	Verification map[string]string `json:"verification"`
	Version      int32             `json:"version"`
	Signature    string            `json:"signature"`
}

func (*RegisterInfluencer) Store

func (ri *RegisterInfluencer) Store(context OipContext) error

func (*RegisterInfluencer) Validate

func (ri *RegisterInfluencer) Validate(context OipContext) (OipAction, error)

type RegisterPlatform

type RegisterPlatform struct {
	Alias        string            `json:"alias"`
	Timestamp    int64             `json:"timestamp"`
	FloAddress   string            `json:"floAddress"`
	Addresses    []PaymentAddress  `json:"addresses"`
	ShortMW      []string          `json:"shortMW"`
	Verification map[string]string `json:"verification"`
	Version      int32             `json:"version"`
	Info         PlatformInfo      `json:"info"`
}

func (RegisterPlatform) Store

func (rp RegisterPlatform) Store(context OipContext) error

func (RegisterPlatform) Validate

func (rp RegisterPlatform) Validate(context OipContext) (OipAction, error)

type RegisterPub

type RegisterPub struct {
	Alias        string                 `json:"alias,omitempty"`
	FloAddress   string                 `json:"floAddress,omitempty"`
	Timestamp    int64                  `json:"timestamp,omitempty"`
	Authorized   []string               `json:"authorized,omitempty"`
	Info         *PublisherInfo         `json:"info,omitempty"`
	Verification *PublisherVerification `json:"verification,omitempty"`
	Signature    string                 `json:"signature,omitempty"`
}

func (RegisterPub) Store

func (rp RegisterPub) Store(context OipContext) error

func (RegisterPub) Validate

func (rp RegisterPub) Validate(context OipContext) (OipAction, error)

type SpatialUnitDetails

type SpatialUnitDetails struct {
	Ns           string          `json:"ns,omitempty"`
	Geometry     *Geometry       `json:"geometry,omitempty"`
	SpatialType  string          `json:"spatialType,omitempty"`
	SpatialUnits []string        `json:"spatialUnits,omitempty"`
	BBox         []float64       `json:"bbox,omitempty"`
	Attrs        json.RawMessage `json:"attrs,omitempty"`
}

type TenureDetails

type TenureDetails struct {
	Ns           string          `json:"ns"`
	TenureType   string          `json:"tenureType"`
	Tenures      []string        `json:"tenures"`
	SpatialUnits []string        `json:"spatialUnits"`
	Attrs        json.RawMessage `json:"attrs"`
}

type TomogramDetails

type TomogramDetails struct {
	Date           int64   `json:"date,omitempty"`
	NCBItaxID      int64   `json:"NCBItaxID,omitempty"`
	TypoNBCI       int64   `json:"NBCItaxID,omitempty"`
	ArtNotes       string  `json:"artNotes,omitempty"`
	ScopeName      string  `json:"scopeName,omitempty"`
	Roles          string  `json:"roles,omitempty"`
	SpeciesName    string  `json:"speciesName,omitempty"`
	Strain         string  `json:"strain,omitempty"`
	TiltSingleDual int64   `json:"tiltSingleDual,omitempty"`
	Defocus        float64 `json:"defocus,omitempty"`
	Dosage         float64 `json:"dosage,omitempty"`
	TiltConstant   float64 `json:"tiltConstant,omitempty"`
	TiltMin        float64 `json:"tiltMin,omitempty"`
	TiltMax        float64 `json:"tiltMax,omitempty"`
	TiltStep       float64 `json:"tiltStep,omitempty"`
	Magnification  float64 `json:"magnification,omitempty"`
	Emdb           string  `json:"emdb,omitempty"`
	Microscopist   string  `json:"microscopist,omitempty"`
	Institution    string  `json:"institution,omitempty"`
	Lab            string  `json:"lab,omitempty"`
	Sid            string  `json:"sid,omitempty"`
}

type Transfer

type Transfer struct {
	Artifact *TransferArtifact `json:"artifact,omitempty"`
}

func (Transfer) Validate

func (t Transfer) Validate(ctx OipContext) (OipAction, error)

type TransferArtifact

type TransferArtifact struct {
	ArtifactID     string `json:"artifactID"`
	ToFloAddress   string `json:"toFloAddress"`
	FromFloAddress string `json:"fromFloAddress"`
	Timestamp      int64  `json:"timestamp"`
	Signature      string `json:"signature"`
}

func (TransferArtifact) Store

func (ta TransferArtifact) Store(context OipContext) error

func (TransferArtifact) Validate

func (ta TransferArtifact) Validate(context OipContext) (OipAction, error)

Jump to

Keyboard shortcuts

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