manager

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostManager

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

func NewPostManager

NewPostManager - create a new post manager

func (PostManager) CreatePost

func (pm PostManager) CreatePost(ctx sdk.Context, author linotypes.AccountKey, postID string, createdBy linotypes.AccountKey, content string, title string) sdk.Error

CreatePost validate and handles CreatePostMsg stateful validation; 1. both author and post id exists. 2. if createdBy is not author, then it must be an app. 3. post's permlink does not exists.

func (PostManager) DeletePost

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

DeletePost - delete post by author or content censorship stateful validation: 1. permlink exists. 2. post not deleted. Delete does not delete the post in kv store, as that will make `permlink` not permanent. It is marked as deleted, then on deleted posts, 1. manager.DoesPostExist will return false. 2. manager.GetPost will return ErrPermlinkDeleted. 3. manager.CreatePost will return ErrPostAlreadyExist.

func (PostManager) DoesPostExist

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

DoesPostExist - check if post exist 1. permlink kv exists. 2. post is not marked as deleted.

func (PostManager) ExecRewardEvent

func (pm PostManager) ExecRewardEvent(ctx sdk.Context, event types.RewardEvent) sdk.Error

ExecRewardEvent - execute reward events.

func (PostManager) ExportToFile

func (pm PostManager) ExportToFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error

Export - to file.

func (PostManager) GetComsumptionWindow added in v0.6.3

func (pm PostManager) GetComsumptionWindow(ctx sdk.Context) linotypes.MiniDollar

func (PostManager) GetPost

func (pm PostManager) GetPost(ctx sdk.Context, permlink linotypes.Permlink) (model.Post, sdk.Error)

GetPost - return post. return err if post is deleted.

func (PostManager) IDADonate

func (pm PostManager) IDADonate(ctx sdk.Context, from linotypes.AccountKey, n linotypes.MiniIDA, author linotypes.AccountKey, postID string, app, signer linotypes.AccountKey) sdk.Error

IDADonate - handle IDA donation.

func (PostManager) ImportFromFile

func (pm PostManager) ImportFromFile(ctx sdk.Context, cdc *codec.Codec, filepath string) error

Import - from file

func (PostManager) LinoDonate

func (pm PostManager) LinoDonate(ctx sdk.Context, from linotypes.AccountKey, amount linotypes.Coin, author linotypes.AccountKey, postID string, app linotypes.AccountKey) sdk.Error

LinoDonate handles donation using lino. stateful validation: 1. post exits 2. from/to account exists. 3. no self donation. 4. if app is not empty, then developer must exist. 5. amount positive > 0. 6. 9.9% of amount > 0 coin.

func (PostManager) UpdatePost

func (pm PostManager) UpdatePost(ctx sdk.Context, author linotypes.AccountKey, postID, title, content string) sdk.Error

UpdatePost - update post title, content and links. stateful validation: 1. author exist. 2. post exist.

Jump to

Keyboard shortcuts

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