Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
- func ValidCommentsDateInvariant(k Keeper) sdk.Invariant
- func ValidPollForUserAnswersInvariant(k Keeper) sdk.Invariant
- func ValidPostForReactionsInvariant(k Keeper) sdk.Invariant
- func ValidPostsInvariant(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) CheckUserPermissionOnSubspace(ctx sdk.Context, subspaceID string, user string) error
- func (k Keeper) DeletePostReaction(ctx sdk.Context, reaction types.PostReaction) error
- func (k Keeper) DoesPostExist(ctx sdk.Context, id string) bool
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) ExtractReactionValueAndShortcode(ctx sdk.Context, reaction string, subspace string) (string, string, error)
- func (k Keeper) GetAllPostReactions(ctx sdk.Context) []types.PostReaction
- func (k Keeper) GetAllReports(ctx sdk.Context) []types.Report
- func (k Keeper) GetAllUserAnswers(ctx sdk.Context) []types.UserAnswer
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) GetPost(ctx sdk.Context, id string) (post types.Post, found bool)
- func (k Keeper) GetPostReaction(ctx sdk.Context, postID, owner, shortCode string) (types.PostReaction, bool)
- func (k Keeper) GetPostReports(ctx sdk.Context, postID string) []types.Report
- func (k Keeper) GetPosts(ctx sdk.Context) []types.Post
- func (k Keeper) GetRegisteredReaction(ctx sdk.Context, shortcode string, subspace string) (reaction types.RegisteredReaction, exist bool)
- func (k Keeper) GetRegisteredReactions(ctx sdk.Context) []types.RegisteredReaction
- func (k Keeper) GetUserAnswer(ctx sdk.Context, postID, user string) (types.UserAnswer, bool)
- func (k Keeper) GetUserAnswersByPost(ctx sdk.Context, postID string) []types.UserAnswer
- func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)
- func (k Keeper) IsCreatorBlockedBySomeTags(ctx sdk.Context, attachments types.Attachments, creator, subspace string) error
- func (k Keeper) IsUserBlocked(ctx sdk.Context, blocker, blocked, subspace string) bool
- func (k Keeper) IteratePostReactions(ctx sdk.Context, fn func(index int64, reaction types.PostReaction) (stop bool))
- func (k Keeper) IteratePostReactionsByPost(ctx sdk.Context, postID string, ...)
- func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Post) (stop bool))
- func (k Keeper) IterateRegisteredReactions(ctx sdk.Context, ...)
- func (k Keeper) IterateUserAnswers(ctx sdk.Context, fn func(index int64, answer types.UserAnswer) (stop bool))
- func (k Keeper) IterateUserAnswersByPost(ctx sdk.Context, postID string, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) Post(goCtx context.Context, req *types.QueryPostRequest) (*types.QueryPostResponse, error)
- func (k Keeper) PostComments(goCtx context.Context, req *types.QueryPostCommentsRequest) (*types.QueryPostCommentsResponse, error)
- func (k Keeper) PostReactions(goCtx context.Context, req *types.QueryPostReactionsRequest) (*types.QueryPostReactionsResponse, error)
- func (k Keeper) Posts(goCtx context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error)
- func (k Keeper) RegisteredReactions(goCtx context.Context, req *types.QueryRegisteredReactionsRequest) (*types.QueryRegisteredReactionsResponse, error)
- func (k Keeper) Reports(ctx context.Context, request *types.QueryReportsRequest) (*types.QueryReportsResponse, error)
- func (k Keeper) SavePost(ctx sdk.Context, post types.Post)
- func (k Keeper) SavePostReaction(ctx sdk.Context, reaction types.PostReaction) error
- func (k Keeper) SaveRegisteredReaction(ctx sdk.Context, reaction types.RegisteredReaction)
- func (k Keeper) SaveReport(ctx sdk.Context, report types.Report) error
- func (k Keeper) SaveUserAnswer(ctx sdk.Context, answer types.UserAnswer)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) UserAnswers(goCtx context.Context, req *types.QueryUserAnswersRequest) (*types.QueryUserAnswersResponse, error)
- func (k Keeper) ValidatePost(ctx sdk.Context, post types.Post) error
- type RelationshipsKeeper
- type SubspacesKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the module
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the posts MsgServer interface for the provided Keeper.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)
RegisterInvariants registers all posts invariants
func ValidCommentsDateInvariant ¶
ValidCommentsDateInvariant checks that comments creation date is always greater than parent creation date
func ValidPollForUserAnswersInvariant ¶
ValidPollForUserAnswersInvariant check that the user answers are referred to a valid post's poll
func ValidPostForReactionsInvariant ¶
ValidPostForReactionsInvariant checks that the post related to the reactions is valid and exists
func ValidPostsInvariant ¶
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.BinaryCodec, storeKey sdk.StoreKey, paramSpace paramstypes.Subspace, rk RelationshipsKeeper, sk SubspacesKeeper, ) Keeper
NewKeeper creates new instances of the posts Keeper
func (Keeper) CheckUserPermissionOnSubspace ¶
func (Keeper) DeletePostReaction ¶
DeletePostReaction removes the reaction from the given data. If no reaction with the same value was previously added from the given user, an expError is returned.
func (Keeper) DoesPostExist ¶
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) GetAllPostReactions ¶
func (k Keeper) GetAllPostReactions(ctx sdk.Context) []types.PostReaction
GetAllRegisteredReactions returns all the post reactions
func (Keeper) GetAllReports ¶
GetAllReports returns the list of all the reports that have been stored inside the given context
func (Keeper) GetAllUserAnswers ¶
func (k Keeper) GetAllUserAnswers(ctx sdk.Context) []types.UserAnswer
GetAllUserAnswers returns all the user answers.
func (Keeper) GetPost ¶
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) GetPostReaction ¶
func (k Keeper) GetPostReaction(ctx sdk.Context, postID, owner, shortCode string) (types.PostReaction, bool)
GetPostReaction returns the post reaction for the given postID, owner and short code. If such reaction does not exist, returns false instead.
func (Keeper) GetPostReports ¶
GetPostReports returns the list of reports associated with the given postID. If no report is associated with the given postID the function will returns an empty list.
func (Keeper) GetPosts ¶
GetPosts returns the list of all the posts that are stored into the current state
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) []types.RegisteredReaction
GetRegisteredReactions returns all the registered reactions
func (Keeper) GetUserAnswer ¶
GetUserAnswer returns the user answer created by the given user address and associated to the post having the given id. If no user answer could be found, returns false instead.
func (Keeper) GetUserAnswersByPost ¶
GetUserAnswersByPost returns the list of all the user answers associated with the given postID that are stored into the current state.
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 ¶
IsUserBlocked tells if the given blocker has blocked the given blocked user
func (Keeper) IteratePostReactions ¶
func (k Keeper) IteratePostReactions(ctx sdk.Context, fn func(index int64, reaction types.PostReaction) (stop bool))
IteratePostReactions iterates through the post reactions and performs the provided function
func (Keeper) IteratePostReactionsByPost ¶
func (k Keeper) IteratePostReactionsByPost(ctx sdk.Context, postID string, fn func(index int64, reaction types.PostReaction) (stop bool))
IteratePostReactionsByPost iterates through the post reactions added to the post with the given id and performs the provided function
func (Keeper) IteratePosts ¶
IteratePosts iterates through the posts set and performs the provided function
func (Keeper) IterateRegisteredReactions ¶
func (k Keeper) IterateRegisteredReactions(ctx sdk.Context, fn func(index int64, reaction types.RegisteredReaction) (stop bool))
IterateRegisteredReactions iterates through the registered reactions and performs the provided function
func (Keeper) IterateUserAnswers ¶
func (k Keeper) IterateUserAnswers(ctx sdk.Context, fn func(index int64, answer types.UserAnswer) (stop bool))
IterateUserAnswers iterates through the user answers and perform the provided function
func (Keeper) IterateUserAnswersByPost ¶
func (k Keeper) IterateUserAnswersByPost(ctx sdk.Context, postID string, fn func(index int64, answer types.UserAnswer) (stop bool))
IterateUserAnswersByPost iterates through the user answers with the given post id and performs the provided function
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) Post ¶
func (k Keeper) Post(goCtx context.Context, req *types.QueryPostRequest) (*types.QueryPostResponse, error)
Post implements the Query/Post gRPC method
func (Keeper) PostComments ¶
func (k Keeper) PostComments( goCtx context.Context, req *types.QueryPostCommentsRequest, ) (*types.QueryPostCommentsResponse, error)
PostComments implements the Query/PostComments gRPC method
func (Keeper) PostReactions ¶
func (k Keeper) PostReactions(goCtx context.Context, req *types.QueryPostReactionsRequest) (*types.QueryPostReactionsResponse, error)
PostReactions implements the Query/PostReactions gRPC method
func (Keeper) Posts ¶
func (k Keeper) Posts(goCtx context.Context, req *types.QueryPostsRequest) (*types.QueryPostsResponse, error)
Posts implements the Query/Posts gRPC method
func (Keeper) RegisteredReactions ¶
func (k Keeper) RegisteredReactions(goCtx context.Context, req *types.QueryRegisteredReactionsRequest) (*types.QueryRegisteredReactionsResponse, error)
RegisteredReactions implements the Query/RegisteredReactions gRPC method
func (Keeper) Reports ¶
func (k Keeper) Reports( ctx context.Context, request *types.QueryReportsRequest, ) (*types.QueryReportsResponse, error)
Reports implements the Query/Reports gRPC method
func (Keeper) SavePost ¶
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 ¶
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) SaveReport ¶
SaveReport allows to save the given report inside the current context. It assumes that the given report has already been validated. If the same report has already been inserted, nothing will be changed.
func (Keeper) SaveUserAnswer ¶
func (k Keeper) SaveUserAnswer(ctx sdk.Context, answer types.UserAnswer)
SaveUserAnswer save the user answer 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) UserAnswers ¶
func (k Keeper) UserAnswers(goCtx context.Context, req *types.QueryUserAnswersRequest) (*types.QueryUserAnswersResponse, error)
UserAnswers implements the Query/UserAnswers gRPC method
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