poststorage

package
v0.0.0-...-783ed30 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClaimChainEmptyError = &tracer.Error{
	Kind: "ClaimChainEmptyError",
	Desc: "The request expects the claim chain not to be empty. The claim chain was found to be empty. Therefore the request failed.",
}
View Source
var ClaimChainInvalidError = &tracer.Error{
	Kind: "ClaimChainInvalidError",
	Desc: "The request expects the claim chain to be empty. The claim chain was not found to be empty. Therefore the request failed.",
}
View Source
var ClaimContractEmptyError = &tracer.Error{
	Kind: "ClaimContractEmptyError",
	Desc: "The request expects the claim contract not to be empty. The claim contract was found to be empty. Therefore the request failed.",
}
View Source
var ClaimExpiryEmptyError = &tracer.Error{
	Kind: "ClaimExpiryEmptyError",
	Desc: "The request expects the claim expiry not to be empty. The claim expiry was found to be empty. Therefore the request failed.",
}
View Source
var ClaimHashFormatError = &tracer.Error{
	Kind: "ClaimHashFormatError",
	Desc: "The request expects the claim hash to be in hex format including 0x prefix. The claim hash was not found to comply with that format. Therefore the request failed.",
}
View Source
var ClaimLabelsEmptyError = &tracer.Error{
	Kind: "ClaimLabelsEmptyError",
	Desc: "The request expects the claim labels not to be empty. The claim labels were found to be empty. Therefore the request failed.",
}
View Source
var ClaimLabelsFormatError = &tracer.Error{
	Kind: "ClaimLabelsFormatError",
	Desc: "The request expects the claim labels to be alpha numerical. The claim labels were not found to be alpha numerical. Therefore the request failed.",
}
View Source
var ClaimLabelsLimitError = &tracer.Error{
	Kind: "ClaimLabelsLimitError",
	Desc: "The request expects the claim not to have more than four labels. The claim was found to have more than four labels. Therefore the request failed.",
}
View Source
var ClaimLabelsUniqueError = &tracer.Error{
	Kind: "ClaimLabelsUniqueError",
	Desc: "The request expects the claim labels to be unique. The claim labels were not found to be unique. Therefore the request failed.",
}
View Source
var ClaimLifecycleInvalidError = &tracer.Error{
	Kind: "ClaimLifecycleInvalidError",
	Desc: "The request expects the claim lifecycle to be one of [balance dispute propose resolve]. The claim lifecycle was not found to be one of those values. Therefore the request failed.",
}
View Source
var ClaimParentEmptyError = &tracer.Error{
	Kind: "ClaimParentEmptyError",
	Desc: "The request expects the claim parent not to be empty. The claim parent was found to be empty. Therefore the request failed.",
}
View Source
var ClaimParentInvalidError = &tracer.Error{
	Kind: "ClaimParentInvalidError",
	Desc: "The request expects the claim parent to be empty. The claim parent was not found to be empty. Therefore the request failed.",
}
View Source
var ClaimTextLengthError = &tracer.Error{
	Kind: "ClaimTextLengthError",
	Desc: "The request expects the claim text to have between 20 and 5000 characters. The claim text was found to be outside of that range of characters. Therefore the request failed.",
}
View Source
var CommentLabelsInvalidError = &tracer.Error{
	Kind: "CommentLabelsInvalidError",
	Desc: "The request expects the comment labels to be empty. The comment labels were not found to be empty. Therefore the request failed.",
}
View Source
var CommentLifecycleInvalidError = &tracer.Error{
	Kind: "CommentLifecycleInvalidError",
	Desc: "The request expects the comment to neither have a hash nor lifecycle. The comment was found to have one of those fields. Therefore the request failed.",
}
View Source
var CommentParentEmptyError = &tracer.Error{
	Kind: "CommentParentEmptyError",
	Desc: "The request expects the comment parent not to be empty. The comment parent was found to be empty. Therefore the request failed.",
}
View Source
var CommentTextLengthError = &tracer.Error{
	Kind: "CommentTextLengthError",
	Desc: "The request expects the comment text to have between 20 and 5000 characters. The comment text was found to be outside of that range of characters. Therefore the request failed.",
}
View Source
var PostKindInvalidError = &tracer.Error{
	Kind: "PostKindInvalidError",
	Desc: "The request expects the post kind to be one of [claim comment]. The post kind was not found to be one of those values. Therefore the request failed.",
}
View Source
var PostObjectNotFoundError = &tracer.Error{
	Kind: "PostObjectNotFoundError",
	Desc: "The request expects a post object to exist. The post object was not found to exist. Therefore the request failed.",
}
View Source
var PostOwnerEmptyError = &tracer.Error{
	Kind: "PostOwnerEmptyError",
	Desc: "The request expects the post owner not to be empty. The post owner was found to be empty. Therefore the request failed.",
}
View Source
var PostTextEmptyError = &tracer.Error{
	Kind: "PostTextEmptyError",
	Desc: "The request expects the post text not to be empty. The post text was found to be empty. Therefore the request failed.",
}
View Source
var PostTokenEmptyError = &tracer.Error{
	Kind: "PostTokenEmptyError",
	Desc: "The request expects the post token not to be empty. The post token was found to be empty. Therefore the request failed.",
}
View Source
var PostTokenInvalidError = &tracer.Error{
	Kind: "PostTokenInvalidError",
	Desc: "The request expects the post token to be empty. The post token was not found to be empty. Therefore the request failed.",
}

Functions

This section is empty.

Types

type Interface

type Interface interface {
	// CreateExpiry adds the referenced IDs of the given post objects to the
	// lifecycle specific PostExpiry index.
	//
	//     @inp[0] the post objects to add to the PostExpiry index
	//
	CreateExpiry(inp []*Object) error

	// CreatePost persists new post objects in the underlying storage.
	//
	//     @inp[0] the post objects to create
	//
	CreatePost([]*Object) error

	// DeleteExpiry removes the referenced IDs of the given post objects from the
	// lifecycle specific PostExpiry index.
	//
	//     @inp[0] the post objects to remove from the PostExpiry index
	//
	DeleteExpiry(inp []*Object) error

	// DeletePost removes existing post objects from the underlying storage.
	// Deleting posts is effectively the reversed operation of CreatePost.
	//
	//     @inp[0] the post objects to delete
	//
	DeletePost([]*Object) error

	// SearchComment returns the post objects that represent market specific
	// comments. All of the comments on a claim can be fetched using this method.
	//
	//     @inp[0] the claim IDs to search for
	//     @out[0] the list of post objects representing market specific comments
	//
	SearchComment([]objectid.ID) ([]*Object, error)

	// SearchPage returns the post objects within the given pagination range in
	// reversed order of claim creation time. Given the indexed posts [A B C D E],
	// the first page [0 3] returns the most recent posts [C D E].
	//
	//     @inp[0] the lifecycle phase to search for
	//     @inp[1] the start paging pointer defining the beginning of the page
	//     @inp[2] the stop paging pointer defining the end of the page
	//     @out[0] the list of post objects within the given pagination range
	//
	SearchPage(objectlabel.DesiredLifecycle, int, int) ([]*Object, error)

	// SearchExpiry returns the lifecycle specific post objects recorded to have
	// expired already at the time of execution.
	//
	//     @inp[0] the lifecycle phase to search for
	//     @out[0] the list of post objects already expired
	//
	SearchExpiry(objectlabel.DesiredLifecycle) ([]*Object, error)

	// SearchLabel returns the post objects grouped under all of the given
	// category labels. Multiple searches can be done for a set of labels each,
	// where each set of labels defines the intersection of claims to search for.
	//
	//     @inp[0] the list of category labels to search for
	//     @out[0] the list of post objects matching the given post IDs
	//
	SearchLabel([][]string) ([]*Object, error)

	// SearchLifecycle returns all the claims that have the specified active
	// lifecycle phases defined. In other words, claims that are of lifecycle
	// phase propose, while being expired, will not be returned.
	//
	//     @inp[0] the lifecycle phases to search for
	//     @out[0] the list of post objects having the specified lifecycle phases defined
	//
	SearchLifecycle([]objectlabel.DesiredLifecycle) ([]*Object, error)

	// SearchOwner returns the post objects created by the given user.
	//
	//     @inp[0] the user IDs to search for
	//     @out[0] the list of post objects created by the given user
	//
	SearchOwner([]objectid.ID) ([]*Object, error)

	// SearchOwnerComment returns the post objects that represent market specific
	// comments made by a specific user. If a user commented on a claim on which
	// they staked reputation or verified events, then SearchOwnerComment will
	// return all comments made by the given user on markets in which they
	// participated in.
	//
	//     @inp[0] the user IDs to search for
	//     @inp[0] the claim IDs to search for
	//     @out[0] the list of post objects representing market and user specific comments
	//
	SearchOwnerComment([]objectid.ID, []objectid.ID) ([]*Object, error)

	// SearchPost returns the post objects matching the given post IDs.
	//
	//     @inp[0] the post IDs to search for
	//     @out[0] the list of post objects matching the given post IDs
	//
	SearchPost([]objectid.ID) ([]*Object, error)

	// SearchTime returns the post objects within the given pagination range of
	// creation time. Given the indexed posts [A B C D E], the time range
	// [1730761200 1730847600] returns the respective posts [B C D].
	//
	//     @inp[0] the lifecycle phase to search for
	//     @inp[1] the start unix timestamp defining the beginning of the page
	//     @inp[2] the stop unix timestamp defining the end of the page
	//     @out[0] the list of post objects within the given pagination range
	//
	SearchTime(objectlabel.DesiredLifecycle, int64, int64) ([]*Object, error)

	// SearchTree returns the post objects belonging to the given tree IDs.
	//
	//     @inp[0] the tree IDs to search for
	//     @out[0] the list of post objects belonging to the given tree IDs
	//
	SearchTree([]objectid.ID) ([]*Object, error)

	// UpdatePost modifies the given post objects in the underlying storage.
	//
	//     @inp[0] the post objects to update
	//
	UpdatePost([]*Object) error
}

func Fake

func Fake() Interface

type Object

type Object struct {
	Chain     string                `json:"chain,omitempty"`
	Contract  string                `json:"contract,omitempty"`
	Created   time.Time             `json:"created,omitempty"`
	Expiry    time.Time             `json:"expiry,omitempty"`
	ID        objectid.ID           `json:"id,omitempty"`
	Kind      string                `json:"kind,omitempty"`
	Labels    []string              `json:"labels,omitempty"`
	Lifecycle objectfield.Lifecycle `json:"lifecycle,omitempty"`
	Meta      string                `json:"meta,omitempty"`
	Owner     objectid.ID           `json:"owner,omitempty"`
	Parent    objectid.ID           `json:"parent,omitempty"`
	Samples   map[string]string     `json:"samples,omitempty"`
	Summary   []float64             `json:"summary,omitempty"`
	Text      string                `json:"text,omitempty"`
	Token     string                `json:"token,omitempty"`
	Tree      objectid.ID           `json:"tree,omitempty"`
}

func (*Object) Verify

func (o *Object) Verify() error

type Redigo

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

func NewRedigo

func NewRedigo(c RedigoConfig) *Redigo

func (*Redigo) CreateExpiry

func (r *Redigo) CreateExpiry(inp []*Object) error

func (*Redigo) CreatePost

func (r *Redigo) CreatePost(inp []*Object) error

func (*Redigo) DeleteExpiry

func (r *Redigo) DeleteExpiry(inp []*Object) error

func (*Redigo) DeletePost

func (r *Redigo) DeletePost(inp []*Object) error

func (*Redigo) SearchComment

func (r *Redigo) SearchComment(cla []objectid.ID) ([]*Object, error)

func (*Redigo) SearchExpiry

func (r *Redigo) SearchExpiry(lif objectlabel.DesiredLifecycle) ([]*Object, error)

func (*Redigo) SearchLabel

func (r *Redigo) SearchLabel(inp [][]string) ([]*Object, error)

func (*Redigo) SearchLifecycle

func (r *Redigo) SearchLifecycle(lif []objectlabel.DesiredLifecycle) ([]*Object, error)

func (*Redigo) SearchOwner

func (r *Redigo) SearchOwner(use []objectid.ID) ([]*Object, error)

func (*Redigo) SearchOwnerComment

func (r *Redigo) SearchOwnerComment(own []objectid.ID, cla []objectid.ID) ([]*Object, error)

func (*Redigo) SearchPage

func (r *Redigo) SearchPage(lif objectlabel.DesiredLifecycle, beg int, end int) ([]*Object, error)

func (*Redigo) SearchPost

func (r *Redigo) SearchPost(inp []objectid.ID) ([]*Object, error)

func (*Redigo) SearchTime

func (r *Redigo) SearchTime(lif objectlabel.DesiredLifecycle, beg int64, end int64) ([]*Object, error)

func (*Redigo) SearchTree

func (r *Redigo) SearchTree(tre []objectid.ID) ([]*Object, error)

func (*Redigo) UpdatePost

func (r *Redigo) UpdatePost(inp []*Object) error

type RedigoConfig

type RedigoConfig struct {
	Log logger.Interface
	Red redigo.Interface
}

type Slicer

type Slicer []*Object

func (Slicer) ID

func (s Slicer) ID() []objectid.ID

func (Slicer) IDObject

func (s Slicer) IDObject(cla objectid.ID) *Object

func (Slicer) LatestObject

func (s Slicer) LatestObject() *Object

func (Slicer) ObjectID

func (s Slicer) ObjectID(oid []objectid.ID) Slicer

func (Slicer) ObjectKind

func (s Slicer) ObjectKind(kin string) Slicer

func (Slicer) ObjectLifecycle

func (s Slicer) ObjectLifecycle(lif objectlabel.DesiredLifecycle) Slicer

func (Slicer) ObjectParent

func (s Slicer) ObjectParent(par objectid.ID) Slicer

func (Slicer) ObjectPending

func (s Slicer) ObjectPending() Slicer

func (Slicer) Parent

func (s Slicer) Parent() []objectid.ID

func (Slicer) Tree

func (s Slicer) Tree() []objectid.ID

Jump to

Keyboard shortcuts

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