post

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrAccountNotFound

func ErrAccountNotFound(author types.AccountKey) sdk.Error

ErrAccountNotFound - error when account is not found

func ErrCannotDonateToSelf

func ErrCannotDonateToSelf(user types.AccountKey) sdk.Error

ErrCannotDonateToSelf - error when donate to self

func ErrCommentAndRepostConflict

func ErrCommentAndRepostConflict() sdk.Error

ErrCommentAndRepostConflict - error when posting with both source post and parent post

func ErrCreatePostSourceInvalid

func ErrCreatePostSourceInvalid(permlink types.Permlink) sdk.Error

ErrCreatePostSourceInvalid - error when repost's source post is invalid

func ErrDeveloperNotFound

func ErrDeveloperNotFound(fromApp types.AccountKey) sdk.Error

ErrDeveloperNotFound - error when develoepr is not found

func ErrDonatePostIsDeleted

func ErrDonatePostIsDeleted(permlink types.Permlink) sdk.Error

ErrDonatePostIsDeleted - error when donate to a deleted post

func ErrGetSourcePost

func ErrGetSourcePost(permlink types.Permlink) sdk.Error

ErrGetSourcePost - error when get repost's source post failed

func ErrIdentifierLengthTooLong

func ErrIdentifierLengthTooLong() sdk.Error

ErrIdentifierLengthTooLong - error when post identifier length is too long

func ErrInvalidMemo

func ErrInvalidMemo() sdk.Error

ErrInvalidMemo - error when donate memo is invalid

func ErrInvalidPostRedistributionSplitRate

func ErrInvalidPostRedistributionSplitRate() sdk.Error

ErrInvalidPostRedistributionSplitRate - error when post redistribution split rate is invalid

func ErrInvalidTarget

func ErrInvalidTarget() sdk.Error

ErrInvalidTarget - error when target post is invalid

func ErrNoAuthor

func ErrNoAuthor() sdk.Error

ErrNoAuthor - error when posting without user

func ErrNoPostID

func ErrNoPostID() sdk.Error

ErrNoPostID - error when posting without post ID

func ErrNoUsername

func ErrNoUsername() sdk.Error

ErrNoUsername - error when posting without username

func ErrPostAlreadyExist

func ErrPostAlreadyExist(permlink types.Permlink) sdk.Error

ErrPostAlreadyExist - error when post is already exist

func ErrPostContentExceedMaxLength

func ErrPostContentExceedMaxLength() sdk.Error

ErrPostContentExceedMaxLength - error when post content is too long

func ErrPostIDTooLong

func ErrPostIDTooLong() sdk.Error

ErrPostIDTooLong - error when post ID is too long

func ErrPostNotFound

func ErrPostNotFound(permlink types.Permlink) sdk.Error

ErrPostNotFound - error when post is not found

func ErrPostTitleExceedMaxLength

func ErrPostTitleExceedMaxLength() sdk.Error

ErrPostTitleExceedMaxLength - error when post title is too long

func ErrPostTooOften added in v0.1.1

func ErrPostTooOften(author types.AccountKey) sdk.Error

ErrPostTooOften - error when user posting too often

func ErrProcessDonation

func ErrProcessDonation(permlink types.Permlink) sdk.Error

ErrProcessDonation - error when donation failed

func ErrProcessSourceDonation

func ErrProcessSourceDonation(permlink types.Permlink) sdk.Error

ErrProcessSourceDonation - error when donate to source post failed

func ErrRedistributionSplitRateLengthTooLong

func ErrRedistributionSplitRateLengthTooLong() sdk.Error

ErrRedistributionSplitRateLengthTooLong - error when redistribution split rate's length is too long

func ErrReportOrUpvoteAlreadyExist

func ErrReportOrUpvoteAlreadyExist(permlink types.Permlink) sdk.Error

ErrReportOrUpvoteAlreadyExist - error when user report or upvote to a post which he already reported or upvoted

func ErrReportOrUpvoteTooOften

func ErrReportOrUpvoteTooOften() sdk.Error

ErrReportOrUpvoteTooOften - error when user report too often

func ErrTooManyURL

func ErrTooManyURL() sdk.Error

ErrTooManyURL - error when posting with too many url

func ErrURLLengthTooLong

func ErrURLLengthTooLong() sdk.Error

ErrURLLengthTooLong - error when post url length is too long

func ErrUpdatePostIsDeleted

func ErrUpdatePostIsDeleted(permlink types.Permlink) sdk.Error

ErrUpdatePostIsDeleted - error when update a deleted post

func InitGlobalManager

func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error

InitGlobalManager - init global manager

func NewHandler

NewHandler - Handle all "post" type messages.

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

Types

type CreatePostMsg

type CreatePostMsg struct {
	Author                  types.AccountKey       `json:"author"`
	PostID                  string                 `json:"post_id"`
	Title                   string                 `json:"title"`
	Content                 string                 `json:"content"`
	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"`
	RedistributionSplitRate string                 `json:"redistribution_split_rate"`
}

CreatePostMsg contains information to create a post

func NewCreatePostMsg

func NewCreatePostMsg(
	author, postID, title, content, parentAuthor, parentPostID,
	sourceAuthor, sourcePostID, redistributionSplitRate string,
	links []types.IDToURLMapping) CreatePostMsg

NewCreatePostMsg - constructs a post msg

func (CreatePostMsg) GetConsumeAmount

func (msg CreatePostMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implements types.Msg

func (CreatePostMsg) GetPermission

func (msg CreatePostMsg) GetPermission() types.Permission

GetPermission - implements types.Msg

func (CreatePostMsg) GetSignBytes

func (msg CreatePostMsg) GetSignBytes() []byte

GetSignBytes - implements sdk.Msg

func (CreatePostMsg) GetSigners

func (msg CreatePostMsg) GetSigners() []sdk.AccAddress

GetSigners - implements sdk.Msg

func (CreatePostMsg) String

func (msg CreatePostMsg) String() string

String implements Stringer

func (CreatePostMsg) Type

func (msg CreatePostMsg) Type() string

Type - implements sdk.Msg

func (CreatePostMsg) ValidateBasic

func (msg CreatePostMsg) ValidateBasic() sdk.Error

ValidateBasic - implements sdk.Msg

type DeletePostMsg

type DeletePostMsg struct {
	Author types.AccountKey `json:"author"`
	PostID string           `json:"post_id"`
}

DeletePostMsg - sent from a user to a post

func NewDeletePostMsg

func NewDeletePostMsg(author, postID string) DeletePostMsg

func (DeletePostMsg) GetConsumeAmount

func (msg DeletePostMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implements types.Msg

func (DeletePostMsg) GetPermission

func (msg DeletePostMsg) GetPermission() types.Permission

GetPermission - implements types.Msg

func (DeletePostMsg) GetSignBytes

func (msg DeletePostMsg) GetSignBytes() []byte

GetSignBytes - implements sdk.Msg

func (DeletePostMsg) GetSigners

func (msg DeletePostMsg) GetSigners() []sdk.AccAddress

GetSigners - implements sdk.Msg

func (DeletePostMsg) String

func (msg DeletePostMsg) String() string

func (DeletePostMsg) Type

func (msg DeletePostMsg) Type() string

Type - implements sdk.Msg

func (DeletePostMsg) ValidateBasic

func (msg DeletePostMsg) ValidateBasic() sdk.Error

ValidateBasic - implements sdk.Msg

type DonateMsg

type DonateMsg struct {
	Username types.AccountKey `json:"username"`
	Amount   types.LNO        `json:"amount"`
	Author   types.AccountKey `json:"author"`
	PostID   string           `json:"post_id"`
	FromApp  types.AccountKey `json:"from_app"`
	Memo     string           `json:"memo"`
}

DonateMsg - sent from a user to a post

func NewDonateMsg

func NewDonateMsg(
	user string, amount types.LNO, author string,
	postID string, fromApp string, memo string) DonateMsg

NewDonateMsg - constructs a donate msg

func (DonateMsg) GetConsumeAmount

func (msg DonateMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implements types.Msg

func (DonateMsg) GetPermission

func (msg DonateMsg) GetPermission() types.Permission

GetPermission - implements types.Msg

func (DonateMsg) GetSignBytes

func (msg DonateMsg) GetSignBytes() []byte

GetSignBytes - implements sdk.Msg

func (DonateMsg) GetSigners

func (msg DonateMsg) GetSigners() []sdk.AccAddress

GetSigners - implements sdk.Msg

func (DonateMsg) String

func (msg DonateMsg) String() string

func (DonateMsg) Type

func (msg DonateMsg) Type() string

Type - implements sdk.Msg

func (DonateMsg) ValidateBasic

func (msg DonateMsg) ValidateBasic() sdk.Error

ValidateBasic - implements sdk.Msg

type PostManager

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

func NewPostManager

func NewPostManager(key sdk.StoreKey, holder param.ParamHolder) PostManager

NewPostManager - create a new post manager

func (PostManager) AddComment

func (pm PostManager) AddComment(
	ctx sdk.Context, permlink types.Permlink, commentAuthor types.AccountKey, commentPostID string) sdk.Error

add comment to post comment list

func (PostManager) AddDonation

func (pm PostManager) AddDonation(
	ctx sdk.Context, permlink types.Permlink, donator types.AccountKey,
	amount types.Coin, donationType types.DonationType) sdk.Error

AddDonation - add donation to post donation list

func (PostManager) AddOrUpdateViewToPost

func (pm PostManager) AddOrUpdateViewToPost(
	ctx sdk.Context, permlink types.Permlink, user types.AccountKey) sdk.Error

AddOrUpdateViewToPost - add or update view from the user if view exists

func (PostManager) CreatePost

func (pm PostManager) CreatePost(
	ctx sdk.Context, author types.AccountKey, postID string,
	sourceAuthor types.AccountKey, sourcePostID string,
	parentAuthor types.AccountKey, parentPostID string,
	content string, title string, redistributionSplitRate sdk.Rat,
	links []types.IDToURLMapping) sdk.Error

create the post

func (PostManager) DeletePost

func (pm PostManager) DeletePost(ctx sdk.Context, permlink types.Permlink) sdk.Error

DeletePost - delete post by author or content censorship

func (PostManager) DoesPostExist

func (pm PostManager) DoesPostExist(ctx sdk.Context, permlink types.Permlink) bool

DoesPostExist - check if post exist

func (PostManager) GetCreatedTimeAndReward

func (pm PostManager) GetCreatedTimeAndReward(ctx sdk.Context, permlink types.Permlink) (int64, types.Coin, sdk.Error)

GetCreatedTimeAndReward - get post created time and reward for evaluate of content value

func (PostManager) GetPenaltyScore

func (pm PostManager) GetPenaltyScore(ctx sdk.Context, reputation types.Coin) (sdk.Rat, sdk.Error)

GetPenaltyScore - get penalty score from report and upvote

func (PostManager) GetRedistributionSplitRate

func (pm PostManager) GetRedistributionSplitRate(ctx sdk.Context, permlink types.Permlink) (sdk.Rat, sdk.Error)

GetRedistributionSplitRate - get post redistribution split rate

func (PostManager) GetSourcePost

func (pm PostManager) GetSourcePost(
	ctx sdk.Context, permlink types.Permlink) (types.AccountKey, string, sdk.Error)

GetSourcePost - return root source post

func (PostManager) IsDeleted

func (pm PostManager) IsDeleted(ctx sdk.Context, permlink types.Permlink) (bool, sdk.Error)

IsDeleted - check if a post is deleted or not

func (PostManager) UpdateLastActivityAt added in v0.1.1

func (pm PostManager) UpdateLastActivityAt(ctx sdk.Context, permlink types.Permlink) sdk.Error

UpdateLastActivityAt - update post last activity at

func (PostManager) UpdatePost

func (pm PostManager) UpdatePost(
	ctx sdk.Context, author types.AccountKey, postID, title, content string,
	links []types.IDToURLMapping) sdk.Error

UpdatePost - update post title, content and links. Can't update a deleted post

type ReportOrUpvoteMsg

type ReportOrUpvoteMsg struct {
	Username types.AccountKey `json:"username"`
	Author   types.AccountKey `json:"author"`
	PostID   string           `json:"post_id"`
	IsReport bool             `json:"is_report"`
}

ReportOrUpvoteMsg - sent from a user to a post

func NewReportOrUpvoteMsg

func NewReportOrUpvoteMsg(
	user, author, postID string, isReport bool) ReportOrUpvoteMsg

NewReportOrUpvoteMsg - constructs a ReportOrUpvote msg

func (ReportOrUpvoteMsg) GetConsumeAmount

func (msg ReportOrUpvoteMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implements types.Msg

func (ReportOrUpvoteMsg) GetPermission

func (msg ReportOrUpvoteMsg) GetPermission() types.Permission

GetPermission - implements types.Msg

func (ReportOrUpvoteMsg) GetSignBytes

func (msg ReportOrUpvoteMsg) GetSignBytes() []byte

GetSignBytes - implements sdk.Msg

func (ReportOrUpvoteMsg) GetSigners

func (msg ReportOrUpvoteMsg) GetSigners() []sdk.AccAddress

GetSigners - implements sdk.Msg

func (ReportOrUpvoteMsg) String

func (msg ReportOrUpvoteMsg) String() string

func (ReportOrUpvoteMsg) Type

func (msg ReportOrUpvoteMsg) Type() string

Type - implements sdk.Msg

func (ReportOrUpvoteMsg) ValidateBasic

func (msg ReportOrUpvoteMsg) ValidateBasic() sdk.Error

ValidateBasic - implements sdk.Msg

type RewardEvent

type RewardEvent struct {
	PostAuthor types.AccountKey `json:"post_author"`
	PostID     string           `json:"post_id"`
	Consumer   types.AccountKey `json:"consumer"`
	Evaluate   types.Coin       `json:"evaluate"`
	Original   types.Coin       `json:"original"`
	Friction   types.Coin       `json:"friction"`
	FromApp    types.AccountKey `json:"from_app"`
}

RewardEvent - when donation occurred, a reward event will be register at 7 days later. After 7 days reward event will be executed and send inflation to author.

func (RewardEvent) Execute

Execute - execute reward event after 7 days

type UpdatePostMsg

type UpdatePostMsg struct {
	Author  types.AccountKey       `json:"author"`
	PostID  string                 `json:"post_id"`
	Title   string                 `json:"title"`
	Content string                 `json:"content"`
	Links   []types.IDToURLMapping `json:"links"`
}

UpdatePostMsg - update post

func NewUpdatePostMsg

func NewUpdatePostMsg(
	author, postID, title, content string, links []types.IDToURLMapping) UpdatePostMsg

NewUpdatePostMsg - constructs a UpdatePost msg

func (UpdatePostMsg) GetConsumeAmount

func (msg UpdatePostMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implements types.Msg

func (UpdatePostMsg) GetPermission

func (msg UpdatePostMsg) GetPermission() types.Permission

GetPermission - implements types.Msg

func (UpdatePostMsg) GetSignBytes

func (msg UpdatePostMsg) GetSignBytes() []byte

GetSignBytes - implements sdk.Msg

func (UpdatePostMsg) GetSigners

func (msg UpdatePostMsg) GetSigners() []sdk.AccAddress

GetSigners - implements sdk.Msg

func (UpdatePostMsg) String

func (msg UpdatePostMsg) String() string

func (UpdatePostMsg) Type

func (msg UpdatePostMsg) Type() string

Type - implements sdk.Msg

func (UpdatePostMsg) ValidateBasic

func (msg UpdatePostMsg) ValidateBasic() sdk.Error

ValidateBasic - implements sdk.Msg

type ViewMsg

type ViewMsg struct {
	Username types.AccountKey `json:"username"`
	Author   types.AccountKey `json:"author"`
	PostID   string           `json:"post_id"`
}

ViewMsg - sent from a user to a post

func NewViewMsg

func NewViewMsg(user, author string, postID string) ViewMsg

NewViewMsg - constructs a view msg

func (ViewMsg) GetConsumeAmount

func (msg ViewMsg) GetConsumeAmount() types.Coin

GetConsumeAmount - implements types.Msg

func (ViewMsg) GetPermission

func (msg ViewMsg) GetPermission() types.Permission

GetPermission - implements types.Msg

func (ViewMsg) GetSignBytes

func (msg ViewMsg) GetSignBytes() []byte

GetSignBytes - implements sdk.Msg

func (ViewMsg) GetSigners

func (msg ViewMsg) GetSigners() []sdk.AccAddress

GetSigners - implements sdk.Msg

func (ViewMsg) String

func (msg ViewMsg) String() string

func (ViewMsg) Type

func (msg ViewMsg) Type() string

Type - implements sdk.Msg

func (ViewMsg) ValidateBasic

func (msg ViewMsg) ValidateBasic() sdk.Error

ValidateBasic - implements sdk.Msg

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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