Documentation ¶
Index ¶
- func ErrFailedToMarshalPostComment(err error) sdk.Error
- func ErrFailedToMarshalPostDonations(err error) sdk.Error
- func ErrFailedToMarshalPostInfo(err error) sdk.Error
- func ErrFailedToMarshalPostMeta(err error) sdk.Error
- func ErrFailedToMarshalPostReportOrUpvote(err error) sdk.Error
- func ErrFailedToMarshalPostView(err error) sdk.Error
- func ErrFailedToUnmarshalPostComment(err error) sdk.Error
- func ErrFailedToUnmarshalPostDonations(err error) sdk.Error
- func ErrFailedToUnmarshalPostInfo(err error) sdk.Error
- func ErrFailedToUnmarshalPostMeta(err error) sdk.Error
- func ErrFailedToUnmarshalPostReportOrUpvote(err error) sdk.Error
- func ErrFailedToUnmarshalPostView(err error) sdk.Error
- func ErrPostCommentNotFound(key []byte) sdk.Error
- func ErrPostDonationNotFound(key []byte) sdk.Error
- func ErrPostMetaNotFound(key []byte) sdk.Error
- func ErrPostNotFound(key []byte) sdk.Error
- func ErrPostReportOrUpvoteNotFound(key []byte) sdk.Error
- func ErrPostViewNotFound(key []byte) sdk.Error
- func GetPostInfoKey(permlink types.Permlink) []byte
- func GetPostInfoPrefix(author types.AccountKey) []byte
- func GetPostMetaKey(permlink types.Permlink) []byte
- type Comment
- type Donations
- type Identifier
- type PostInfo
- type PostMeta
- type PostStorage
- func (ps PostStorage) DoesPostExist(ctx sdk.Context, permlink types.Permlink) bool
- func (ps PostStorage) GetPostComment(ctx sdk.Context, permlink types.Permlink, commentPermlink types.Permlink) (*Comment, sdk.Error)
- func (ps PostStorage) GetPostDonations(ctx sdk.Context, permlink types.Permlink, donateUser types.AccountKey) (*Donations, sdk.Error)
- func (ps PostStorage) GetPostInfo(ctx sdk.Context, permlink types.Permlink) (*PostInfo, sdk.Error)
- func (ps PostStorage) GetPostMeta(ctx sdk.Context, permlink types.Permlink) (*PostMeta, sdk.Error)
- func (ps PostStorage) GetPostReportOrUpvote(ctx sdk.Context, permlink types.Permlink, user types.AccountKey) (*ReportOrUpvote, sdk.Error)
- func (ps PostStorage) GetPostView(ctx sdk.Context, permlink types.Permlink, viewUser types.AccountKey) (*View, sdk.Error)
- func (ps PostStorage) SetPostComment(ctx sdk.Context, permlink types.Permlink, postComment *Comment) sdk.Error
- func (ps PostStorage) SetPostDonations(ctx sdk.Context, permlink types.Permlink, postDonations *Donations) sdk.Error
- func (ps PostStorage) SetPostInfo(ctx sdk.Context, postInfo *PostInfo) sdk.Error
- func (ps PostStorage) SetPostMeta(ctx sdk.Context, permlink types.Permlink, postMeta *PostMeta) sdk.Error
- func (ps PostStorage) SetPostReportOrUpvote(ctx sdk.Context, permlink types.Permlink, reportOrUpvote *ReportOrUpvote) sdk.Error
- func (ps PostStorage) SetPostView(ctx sdk.Context, permlink types.Permlink, postView *View) sdk.Error
- type ReportOrUpvote
- type URL
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrFailedToMarshalPostComment ¶
ErrFailedToMarshalPostComment - error if marshal post comment failed
func ErrFailedToMarshalPostDonations ¶
ErrFailedToMarshalPostDonations - error if marshal post donation failed
func ErrFailedToMarshalPostInfo ¶
ErrFailedToMarshalPostInfo - error if marshal post info failed
func ErrFailedToMarshalPostMeta ¶
ErrFailedToMarshalPostMeta - error if marshal post meta failed
func ErrFailedToMarshalPostReportOrUpvote ¶
ErrFailedToMarshalPostReportOrUpvote - error if marshal post report or upvote failed
func ErrFailedToMarshalPostView ¶
ErrFailedToMarshalPostView - error if marshal post view failed
func ErrFailedToUnmarshalPostComment ¶
ErrFailedToUnmarshalPostComment - error if unmarshal post comment failed
func ErrFailedToUnmarshalPostDonations ¶
ErrFailedToUnmarshalPostDonations - error if unmarshal post donations failed
func ErrFailedToUnmarshalPostInfo ¶
ErrFailedToUnmarshalPostInfo - error if unmarshal post info failed
func ErrFailedToUnmarshalPostMeta ¶
ErrFailedToUnmarshalPostMeta - error if unmarshal post meta failed
func ErrFailedToUnmarshalPostReportOrUpvote ¶
ErrFailedToUnmarshalPostReportOrUpvote - error if unmarshal post report or upvote failed
func ErrFailedToUnmarshalPostView ¶
ErrFailedToUnmarshalPostView - error if unmarshal post view failed
func ErrPostCommentNotFound ¶
ErrPostCommentNotFound - error if comment is not found in KVStore
func ErrPostDonationNotFound ¶
ErrPostDonationNotFound - error if post donation is not found in KVStore
func ErrPostMetaNotFound ¶
ErrPostMetaNotFound - error if post meta is not found in KVStore
func ErrPostNotFound ¶
ErrPostNotFound - error if post is not found in KVStore
func ErrPostReportOrUpvoteNotFound ¶
ErrPostReportOrUpvoteNotFound - error if report or upvote is not found in KVStore
func ErrPostViewNotFound ¶
ErrPostViewNotFound - error if view is not found in KVStore
func GetPostInfoKey ¶
GetPostInfoKey - "post info substore" + "permlink"
func GetPostInfoPrefix ¶ added in v0.1.1
func GetPostInfoPrefix(author types.AccountKey) []byte
GetPostInfoPrefix - "post info substore" + "author"
func GetPostMetaKey ¶
GetPostMetaKey - "post meta substore" + "permlink"
Types ¶
type Comment ¶
type Comment struct { Author types.AccountKey `json:"author"` PostID string `json:"post_id"` CreatedAt int64 `json:"created_at"` }
Comment - comment list store dy a post
type Donations ¶
type Donations struct { Username types.AccountKey `json:"username"` Times int64 `json:"times"` Amount types.Coin `json:"amount"` }
Donations - record a user donation behavior to a post
type PostInfo ¶
type PostInfo struct { PostID string `json:"post_id"` Title string `json:"title"` Content string `json:"content"` Author types.AccountKey `json:"author"` ParentAuthor types.AccountKey `json:"parent_author"` ParentPostID string `json:"parent_postID"` SourceAuthor types.AccountKey `json:"source_author"` SourcePostID string `json:"source_postID"` Links []types.IDToURLMapping `json:"links"` }
PostInfo - can also use to present comment(with parent) or repost(with source)
type PostMeta ¶
type PostMeta struct { CreatedAt int64 `json:"created_at"` LastUpdatedAt int64 `json:"last_updated_at"` LastActivityAt int64 `json:"last_activity_at"` AllowReplies bool `json:"allow_replies"` IsDeleted bool `json:"is_deleted"` TotalDonateCount int64 `json:"total_donate_count"` TotalReportCoinDay types.Coin `json:"total_report_coin_day"` TotalUpvoteCoinDay types.Coin `json:"total_upvote_coin_day"` TotalViewCount int64 `json:"total_view_count"` TotalReward types.Coin `json:"total_reward"` RedistributionSplitRate sdk.Rat `json:"redistribution_split_rate"` }
PostMeta - stores tiny and frequently updated fields.
type PostStorage ¶
type PostStorage struct {
// contains filtered or unexported fields
}
PostStorage - post storage
func NewPostStorage ¶
func NewPostStorage(key sdk.StoreKey) PostStorage
NewPostStorage - returns a new PostStorage that uses codec to (binary) encode and decode concrete Post
func (PostStorage) DoesPostExist ¶
DoesPostExist - check if a post exists in KVStore or not
func (PostStorage) GetPostComment ¶
func (ps PostStorage) GetPostComment( ctx sdk.Context, permlink types.Permlink, commentPermlink types.Permlink) (*Comment, sdk.Error)
GetPostComment - get post comment from KVStore
func (PostStorage) GetPostDonations ¶
func (ps PostStorage) GetPostDonations( ctx sdk.Context, permlink types.Permlink, donateUser types.AccountKey) (*Donations, sdk.Error)
GetPostDonations - get post donations from KVStore
func (PostStorage) GetPostInfo ¶
GetPostInfo - get post info from KVStore
func (PostStorage) GetPostMeta ¶
GetPostMeta - get post meta from KVStore
func (PostStorage) GetPostReportOrUpvote ¶
func (ps PostStorage) GetPostReportOrUpvote( ctx sdk.Context, permlink types.Permlink, user types.AccountKey) (*ReportOrUpvote, sdk.Error)
GetPostReportOrUpvote - get report or upvote from KVStore
func (PostStorage) GetPostView ¶
func (ps PostStorage) GetPostView( ctx sdk.Context, permlink types.Permlink, viewUser types.AccountKey) (*View, sdk.Error)
GetPostView - get post view from KVStore
func (PostStorage) SetPostComment ¶
func (ps PostStorage) SetPostComment( ctx sdk.Context, permlink types.Permlink, postComment *Comment) sdk.Error
SetPostComment - set post comment to KVStore
func (PostStorage) SetPostDonations ¶
func (ps PostStorage) SetPostDonations( ctx sdk.Context, permlink types.Permlink, postDonations *Donations) sdk.Error
SetPostDonations - set post donations to KVStore
func (PostStorage) SetPostInfo ¶
SetPostInfo - set post info to KVStore
func (PostStorage) SetPostMeta ¶
func (ps PostStorage) SetPostMeta(ctx sdk.Context, permlink types.Permlink, postMeta *PostMeta) sdk.Error
SetPostMeta - set post meta to KVStore
func (PostStorage) SetPostReportOrUpvote ¶
func (ps PostStorage) SetPostReportOrUpvote( ctx sdk.Context, permlink types.Permlink, reportOrUpvote *ReportOrUpvote) sdk.Error
SetPostReportOrUpvote - set report or upvote to KVStore
func (PostStorage) SetPostView ¶
func (ps PostStorage) SetPostView(ctx sdk.Context, permlink types.Permlink, postView *View) sdk.Error
SetPostView - set post view to KVStore
type ReportOrUpvote ¶
type ReportOrUpvote struct { Username types.AccountKey `json:"username"` CoinDay types.Coin `json:"coin_day"` CreatedAt int64 `json:"created_at"` IsReport bool `json:"is_report"` }
ReportOrUpvote - report or upvote from a user to a post