keeper

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the module

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the posts MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)

RegisterInvariants registers all posts invariants

func ValidCommentsDateInvariant

func ValidCommentsDateInvariant(k Keeper) sdk.Invariant

ValidCommentsDateInvariant checks that comments creation date is always greater than parent creation date

func ValidPollForPollAnswersInvariant

func ValidPollForPollAnswersInvariant(k Keeper) sdk.Invariant

ValidPollForPollAnswersInvariant check that the poll answers are referred to a valid post's poll

func ValidPostForReactionsInvariant

func ValidPostForReactionsInvariant(k Keeper) sdk.Invariant

ValidPostForReactionsInvariant checks that the post related to the reactions is valid and exists

func ValidPostsInvariant

func ValidPostsInvariant(k Keeper) sdk.Invariant

ValidPostsInvariant checks that the all posts are valid

Types

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(
	cdc codec.BinaryMarshaler, storeKey sdk.StoreKey,
	paramSpace paramstypes.Subspace, rk RelationshipsKeeper,
) Keeper

NewKeeper creates new instances of the posts Keeper

func (Keeper) DeletePostReaction

func (k Keeper) DeletePostReaction(ctx sdk.Context, postID string, reaction types.PostReaction) error

DeletePostReaction removes the reaction from the given user from the post having the given postID. If no reaction with the same value was previously added from the given user, an expError is returned.

func (Keeper) DoesPostExist

func (k Keeper) DoesPostExist(ctx sdk.Context, id string) bool

DoesPostExist returns true if the post with the given id exists inside the store.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the GenesisState associated with the given context

func (Keeper) ExtractReactionValueAndShortcode

func (k Keeper) ExtractReactionValueAndShortcode(ctx sdk.Context, reaction string, subspace string) (string, string, error)

ExtractReactionValueAndShortcode parse the given registeredReactions returning its correct value and shortcode

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)

GetParams returns the params from the store

func (Keeper) GetPollAnswers

func (k Keeper) GetPollAnswers(ctx sdk.Context, postID string) []types.UserAnswer

GetPollAnswers returns the list of all the post polls answers associated with the given postID that are stored into the current state.

func (Keeper) GetPollAnswersByUser

func (k Keeper) GetPollAnswersByUser(ctx sdk.Context, postID string, user string) []string

GetPollAnswersByUser retrieves post poll answers associated to the given ID and filtered by user

func (Keeper) GetPost

func (k Keeper) GetPost(ctx sdk.Context, id string) (post types.Post, found bool)

GetPost returns the post having the given id inside the current context. If no post having the given id can be found inside the current context, false will be returned.

func (Keeper) GetPostChildrenIDs

func (k Keeper) GetPostChildrenIDs(ctx sdk.Context, postID string) []string

GetPostChildrenIDs returns the IDs of all the children posts associated to the post having the given postID nolint: interfacer

func (Keeper) GetPostReactions

func (k Keeper) GetPostReactions(ctx sdk.Context, postID string) []types.PostReaction

GetPostReactions returns the list of reactions that has been associated to the post having the given id

func (Keeper) GetPostReactionsEntries

func (k Keeper) GetPostReactionsEntries(ctx sdk.Context) []types.PostReactionsEntry

GetPostReactionsEntries allows to returns the list of reactions that have been stored inside the given context

func (Keeper) GetPosts

func (k Keeper) GetPosts(ctx sdk.Context) []types.Post

GetPosts returns the list of all the posts that are stored into the current state sorted by their incremental ID.

func (Keeper) GetPostsFiltered

func (k Keeper) GetPostsFiltered(ctx sdk.Context, params types.QueryPostsParams) []types.Post

GetPostsFiltered retrieves posts filtered by a given set of params which include pagination parameters along with the creator address, the parent id and the creation time.

NOTE: If no filters are provided, all posts will be returned in paginated form.

func (Keeper) GetRegisteredReaction

func (k Keeper) GetRegisteredReaction(
	ctx sdk.Context, shortcode string, subspace string,
) (reaction types.RegisteredReaction, exist bool)

GetRegisteredReaction returns the registered reactions which has the given shortcode and is registered to be used inside the given subspace. If no reaction could be found, returns false instead.

func (Keeper) GetRegisteredReactions

func (k Keeper) GetRegisteredReactions(ctx sdk.Context) (reactions []types.RegisteredReaction)

GetRegisteredReactions returns all the registered reactions

func (Keeper) GetUserAnswersEntries

func (k Keeper) GetUserAnswersEntries(ctx sdk.Context) []types.UserAnswersEntry

GetUserAnswersEntries allows to returns the list of answers that have been stored inside the given context

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)

InitGenesis initializes the chain state based on the given GenesisState

func (Keeper) IsCreatorBlockedBySomeTags

func (k Keeper) IsCreatorBlockedBySomeTags(ctx sdk.Context, attachments types.Attachments, creator, subspace string) error

IsCreatorBlockedBySomeTags checks if some of the post's tags have blocked the post's creator

func (Keeper) IsUserBlocked

func (k Keeper) IsUserBlocked(ctx sdk.Context, blocker, blocked, subspace string) bool

IsUserBlocked tells if the given blocker has blocked the given blocked user

func (Keeper) IteratePosts

func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Post) (stop bool))

IteratePosts iterates through the posts set and performs the provided function It makes a copy of the posts array which is done only for sorting purposes.

func (Keeper) Params

func (Keeper) Post

func (Keeper) Posts

func (Keeper) SavePollAnswers

func (k Keeper) SavePollAnswers(ctx sdk.Context, postID string, userPollAnswers types.UserAnswer)

SavePollAnswers save the poll's answers associated with the given postID inside the current context It assumes that the post exists and has a Poll inside it. If answer are already present, the old ones will be overridden.

func (Keeper) SavePost

func (k Keeper) SavePost(ctx sdk.Context, post types.Post)

SavePost allows to save the given post inside the current context. It assumes that the given post has already been validated. If another post has the same ID of the given post, the old post will be overridden

func (Keeper) SavePostReaction

func (k Keeper) SavePostReaction(ctx sdk.Context, postID string, reaction types.PostReaction) error

SavePostReaction allows to save the given reaction inside the store. It assumes that the given reaction is valid and already registered. If another reaction from the same user for the same post and with the same value exists, returns an expError.

func (Keeper) SaveRegisteredReaction

func (k Keeper) SaveRegisteredReaction(ctx sdk.Context, reaction types.RegisteredReaction)

SaveRegisteredReaction allows to register a new reaction for later reference

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets params on the store

func (Keeper) ValidatePost

func (k Keeper) ValidatePost(ctx sdk.Context, post types.Post) error

ValidatePost checks if the given post is valid according to the current posts' module params

type RelationshipsKeeper

type RelationshipsKeeper interface {
	HasUserBlocked(ctx sdk.Context, blocker string, blocked string, subspace string) bool
}

RelationshipsKeeper represents the expected k to deal with users relationships

Jump to

Keyboard shortcuts

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