keeper

package
v0.0.0-...-03ee383 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the stored MsgServer interface for the provided k

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)

RegisterInvariants registers all posts invariants

func ValidActivePollsInvariant

func ValidActivePollsInvariant(k Keeper) sdk.Invariant

ValidActivePollsInvariant checks that all the active polls are valid

func ValidAttachmentsInvariant

func ValidAttachmentsInvariant(k Keeper) sdk.Invariant

ValidAttachmentsInvariant checks that all the attachments are valid

func ValidPostsInvariant

func ValidPostsInvariant(k Keeper) sdk.Invariant

ValidPostsInvariant checks that all the posts are valid

func ValidSubspacesInvariant

func ValidSubspacesInvariant(k Keeper) sdk.Invariant

ValidSubspacesInvariant checks that all the subspaces have a valid post id to them

func ValidUserAnswersInvariant

func ValidUserAnswersInvariant(k Keeper) sdk.Invariant

ValidUserAnswersInvariant checks that all the user answers are valid

Types

type Hooks

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

Hooks represents a wrapper struct

func (Hooks) AfterSubspaceDeleted

func (h Hooks) AfterSubspaceDeleted(ctx sdk.Context, subspaceID uint64)

AfterSubspaceDeleted implements subspacestypes.Hooks

func (Hooks) AfterSubspaceGroupDeleted

func (h Hooks) AfterSubspaceGroupDeleted(sdk.Context, uint64, uint32)

AfterSubspaceGroupDeleted implements subspacestypes.Hooks

func (Hooks) AfterSubspaceGroupMemberAdded

func (h Hooks) AfterSubspaceGroupMemberAdded(sdk.Context, uint64, uint32, string)

AfterSubspaceGroupMemberAdded implements subspacestypes.Hooks

func (Hooks) AfterSubspaceGroupMemberRemoved

func (h Hooks) AfterSubspaceGroupMemberRemoved(sdk.Context, uint64, uint32, string)

AfterSubspaceGroupMemberRemoved implements subspacestypes.Hooks

func (Hooks) AfterSubspaceGroupSaved

func (h Hooks) AfterSubspaceGroupSaved(sdk.Context, uint64, uint32)

AfterSubspaceGroupSaved implements subspacestypes.Hooks

func (Hooks) AfterSubspaceSaved

func (h Hooks) AfterSubspaceSaved(ctx sdk.Context, subspaceID uint64)

AfterSubspaceSaved implements subspacestypes.Hooks

func (Hooks) AfterSubspaceSectionDeleted

func (h Hooks) AfterSubspaceSectionDeleted(ctx sdk.Context, subspaceID uint64, sectionID uint32)

AfterSubspaceSectionDeleted implements subspacestypes.Hooks

func (Hooks) AfterSubspaceSectionSaved

func (h Hooks) AfterSubspaceSectionSaved(sdk.Context, uint64, uint32)

AfterSubspaceSectionSaved implements subspacestypes.Hooks

func (Hooks) AfterUserPermissionRemoved

func (h Hooks) AfterUserPermissionRemoved(sdk.Context, uint64, uint32, string)

AfterUserPermissionRemoved implements subspacestypes.Hooks

func (Hooks) AfterUserPermissionSet

func (h Hooks) AfterUserPermissionSet(sdk.Context, uint64, uint32, string, subspacestypes.Permissions)

AfterUserPermissionSet implements subspacestypes.Hooks

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

NewKeeper creates a new instance of the Posts Keeper.

func (Keeper) AfterAttachmentDeleted

func (k Keeper) AfterAttachmentDeleted(ctx sdk.Context, subspaceID uint64, postID uint64, attachmentID uint32)

AfterAttachmentDeleted implements types.PostsHooks

func (Keeper) AfterAttachmentSaved

func (k Keeper) AfterAttachmentSaved(ctx sdk.Context, subspaceID uint64, postID uint64, attachmentID uint32)

AfterAttachmentSaved implements types.PostsHooks

func (Keeper) AfterPollAnswerDeleted

func (k Keeper) AfterPollAnswerDeleted(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32, user string)

AfterPollAnswerDeleted implements types.PostsHooks

func (Keeper) AfterPollAnswerSaved

func (k Keeper) AfterPollAnswerSaved(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32, user string)

AfterPollAnswerSaved implements types.PostsHooks

func (Keeper) AfterPollVotingPeriodEnded

func (k Keeper) AfterPollVotingPeriodEnded(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32)

AfterPollVotingPeriodEnded implements types.PostsHooks

func (Keeper) AfterPostDeleted

func (k Keeper) AfterPostDeleted(ctx sdk.Context, subspaceID uint64, postID uint64)

AfterPostDeleted implements types.PostsHooks

func (Keeper) AfterPostSaved

func (k Keeper) AfterPostSaved(ctx sdk.Context, subspaceID uint64, postID uint64)

AfterPostSaved implements types.PostsHooks

func (Keeper) DeleteAttachment

func (k Keeper) DeleteAttachment(ctx sdk.Context, subspaceID uint64, postID uint64, attachmentID uint32)

DeleteAttachment deletes the given attachment from the current context

func (Keeper) DeleteNextAttachmentID

func (k Keeper) DeleteNextAttachmentID(ctx sdk.Context, subspaceID uint64, postID uint64)

DeleteNextAttachmentID deletes the store key used to store the next attachment id for the post having the given id

func (Keeper) DeleteNextPostID

func (k Keeper) DeleteNextPostID(ctx sdk.Context, subspaceID uint64)

DeleteNextPostID removes the post id key for the given subspace

func (Keeper) DeletePost

func (k Keeper) DeletePost(ctx sdk.Context, subspaceID uint64, postID uint64)

DeletePost deletes the given post and all its attachments from the store

func (Keeper) DeleteUserAnswer

func (k Keeper) DeleteUserAnswer(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32, user string)

DeleteUserAnswer deletes the user answer from the provided poll

func (Keeper) ExportGenesis

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

ExportGenesis returns the GenesisState associated with the given context

func (Keeper) GetAttachment

func (k Keeper) GetAttachment(ctx sdk.Context, subspaceID uint64, postID uint64, attachmentID uint32) (attachment types.Attachment, found bool)

GetAttachment returns the attachment associated with the given id. If there is no attachment associated with the given id the function will return an empty attachment and false.

func (Keeper) GetNextAttachmentID

func (k Keeper) GetNextAttachmentID(ctx sdk.Context, subspaceID uint64, postID uint64) (attachmentID uint32, err error)

GetNextAttachmentID gets the highest attachment id for the given post

func (Keeper) GetNextPostID

func (k Keeper) GetNextPostID(ctx sdk.Context, subspaceID uint64) (postID uint64, err error)

GetNextPostID gets the highest post id for the given subspace

func (Keeper) GetParams

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

GetParams returns the params from the store

func (Keeper) GetPoll

func (k Keeper) GetPoll(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32) (poll *types.Poll, found bool)

GetPoll returns the poll having the given id. If not poll with the given id is found, the function returns nil and false.

func (Keeper) GetPollUserAnswers

func (k Keeper) GetPollUserAnswers(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32) []types.UserAnswer

GetPollUserAnswers returns all the user answers for the given poll

func (Keeper) GetPost

func (k Keeper) GetPost(ctx sdk.Context, subspaceID uint64, postID uint64) (post types.Post, found bool)

GetPost returns the post associated with the given id. If there is no post associated with the given id the function will return an empty post and false.

func (Keeper) GetPostAttachments

func (k Keeper) GetPostAttachments(ctx sdk.Context, subspaceID uint64, postID uint64) []types.Attachment

GetPostAttachments returns all the attachments associated to the given post

func (Keeper) GetPosts

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

GetPosts returns all the posts stored inside the given context

func (Keeper) GetSubspacePosts

func (k Keeper) GetSubspacePosts(ctx sdk.Context, subspaceID uint64) []types.Post

GetSubspacePosts returns all the posts for the given subspace

func (Keeper) GetUserAnswer

func (k Keeper) GetUserAnswer(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32, user string) (answer types.UserAnswer, found bool)

GetUserAnswer returns the user answer from the given user for the specified poll. If there is no answer result associated with the given poll and user the function will return an empty answer and false.

func (Keeper) HasAttachment

func (k Keeper) HasAttachment(ctx sdk.Context, subspaceID uint64, postID uint64, attachmentID uint32) bool

HasAttachment tells whether the given attachment exists or not

func (Keeper) HasNextAttachmentID

func (k Keeper) HasNextAttachmentID(ctx sdk.Context, subspaceID uint64, postID uint64) bool

HasNextAttachmentID checks whether the given post already has an attachment id

func (Keeper) HasNextPostID

func (k Keeper) HasNextPostID(ctx sdk.Context, subspaceID uint64) bool

HasNextPostID tells whether the next post id key existing for the given subspace

func (Keeper) HasPermission

func (k Keeper) HasPermission(ctx sdk.Context, subspaceID uint64, sectionID uint32, user string, permission subspacetypes.Permission) bool

HasPermission checks whether the given user has the provided permissions or not

func (Keeper) HasPoll

func (k Keeper) HasPoll(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32) bool

HasPoll tells whether the specified post contains a poll with the provided id

func (Keeper) HasPost

func (k Keeper) HasPost(ctx sdk.Context, subspaceID uint64, postID uint64) bool

HasPost tells whether the given post exists or not

func (Keeper) HasProfile

func (k Keeper) HasProfile(ctx sdk.Context, user string) bool

HasProfile returns true iff the given user has a profile, or an error if something is wrong.

func (Keeper) HasRelationship

func (k Keeper) HasRelationship(ctx sdk.Context, user, counterparty string, subspaceID uint64) bool

HasRelationship tells whether the relationship between the user and counterparty exists for the given subspace

func (Keeper) HasSection

func (k Keeper) HasSection(ctx sdk.Context, subspaceID uint64, sectionID uint32) bool

HasSection tells whether the section having the given id exists inside the provided subspace

func (Keeper) HasSubspace

func (k Keeper) HasSubspace(ctx sdk.Context, subspaceID uint64) bool

HasSubspace checks whether the given subspace exists or not

func (Keeper) HasUserAnswer

func (k Keeper) HasUserAnswer(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32, user string) bool

HasUserAnswer tells whether a user answer to the specified poll exists

func (Keeper) HasUserBlocked

func (k Keeper) HasUserBlocked(ctx sdk.Context, blocker, user string, subspaceID uint64) bool

HasUserBlocked tells whether the given blocker has blocked the user inside the provided subspace

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Hooks creates new subspaces hooks

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) InsertActivePollQueue

func (k Keeper) InsertActivePollQueue(ctx sdk.Context, poll types.Attachment)

InsertActivePollQueue inserts a poll into the active poll queue

func (Keeper) IterateActivePolls

func (k Keeper) IterateActivePolls(ctx sdk.Context, fn func(poll types.Attachment) (stop bool))

IterateActivePolls iterates over the polls in the active polls queue and performs the provided function

func (Keeper) IterateActivePollsQueue

func (k Keeper) IterateActivePollsQueue(ctx sdk.Context, endTime time.Time, fn func(poll types.Attachment) (stop bool))

IterateActivePollsQueue iterates over the polls that are still active by the time given performs the provided function

func (Keeper) IterateAttachments

func (k Keeper) IterateAttachments(ctx sdk.Context, fn func(attachment types.Attachment) (stop bool))

IterateAttachments iterates over all the attachments in the given context and performs the provided function

func (Keeper) IteratePollUserAnswers

func (k Keeper) IteratePollUserAnswers(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32, fn func(answer types.UserAnswer) (stop bool))

IteratePollUserAnswers iterates through the answers to the given poll and performs the provided function

func (Keeper) IteratePostAttachments

func (k Keeper) IteratePostAttachments(ctx sdk.Context, subspaceID uint64, postID uint64, fn func(attachment types.Attachment) (stop bool))

IteratePostAttachments iterates through the attachments associated with the provided post and performs the given function

func (Keeper) IteratePostIDs

func (k Keeper) IteratePostIDs(ctx sdk.Context, fn func(subspaceID uint64, postID uint64) (stop bool))

IteratePostIDs iterates over all the next post ids and performs the provided function

func (Keeper) IteratePosts

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

IteratePosts iterates over all the posts stored inside the context and performs the provided function

func (Keeper) IterateSectionPosts

func (k Keeper) IterateSectionPosts(ctx sdk.Context, subspaceID uint64, sectionID uint32, fn func(post types.Post) (stop bool))

IterateSectionPosts iterates over all the posts stored inside the given section and performs the provided function

func (Keeper) IterateSubspacePosts

func (k Keeper) IterateSubspacePosts(ctx sdk.Context, subspaceID uint64, fn func(post types.Post) (stop bool))

IterateSubspacePosts iterates over all the posts stored inside the given subspace and performs the provided function

func (Keeper) IterateUserAnswers

func (k Keeper) IterateUserAnswers(ctx sdk.Context, fn func(answer types.UserAnswer) (stop bool))

IterateUserAnswers iterates over all the polls user answers and performs the provided function

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger

func (Keeper) Params

Params implements the QueryParams gRPC method

func (Keeper) PollAnswers

PollAnswers implements the QueryPollAnswers gRPC method

func (Keeper) Post

Post implements the QueryPost gRPC method

func (Keeper) PostAttachments

PostAttachments implements the QueryPostAttachments gRPC method

func (Keeper) RemoveFromActivePollQueue

func (k Keeper) RemoveFromActivePollQueue(ctx sdk.Context, poll types.Attachment)

RemoveFromActivePollQueue removes a poll from the active poll queue

func (Keeper) SaveAttachment

func (k Keeper) SaveAttachment(ctx sdk.Context, attachment types.Attachment)

SaveAttachment saves the given attachment inside the current context

func (Keeper) SavePost

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

SavePost saves the given post inside the current context.

func (Keeper) SaveUserAnswer

func (k Keeper) SaveUserAnswer(ctx sdk.Context, answer types.UserAnswer)

SaveUserAnswer stores the given poll answer into the current context

func (Keeper) SectionPosts

SectionPosts implements the QuerySectionPosts gRPC method

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(sh types.PostsHooks) *Keeper

SetHooks allows to set the posts hooks

func (Keeper) SetNextAttachmentID

func (k Keeper) SetNextAttachmentID(ctx sdk.Context, subspaceID uint64, postID uint64, attachmentID uint32)

SetNextAttachmentID sets the new attachment id for the given post to the store

func (Keeper) SetNextPostID

func (k Keeper) SetNextPostID(ctx sdk.Context, subspaceID uint64, postID uint64)

SetNextPostID sets the new post id for the given subspace to the store

func (Keeper) SetParams

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

SetParams sets params on the store

func (Keeper) SubspacePosts

SubspacePosts implements the QuerySubspacePosts gRPC method

func (Keeper) Tally

func (k Keeper) Tally(ctx sdk.Context, subspaceID uint64, postID uint64, pollID uint32) *types.PollTallyResults

Tally iterates over the votes and returns the tally results of a poll

func (Keeper) ValidatePost

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

ValidatePost validates the given post based on the current params, returning an error if anything is wrong

func (Keeper) ValidatePostReference

func (k Keeper) ValidatePostReference(ctx sdk.Context, postAuthor string, subspaceID uint64, referenceID uint64) error

ValidatePostReference checks the post reference to make sure that the referenced post's author has not blocked the user referencing the post

func (Keeper) ValidatePostReply

func (k Keeper) ValidatePostReply(ctx sdk.Context, postAuthor string, subspaceID uint64, referenceID uint64) error

ValidatePostReply checks the original post reply settings to make sure that only specified users can answer to the post

type Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper, sk types.SubspacesKeeper) Migrator

NewMigrator returns a new Migrator

func (Migrator) Migrate1to2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

func (Migrator) Migrate2to3

func (m Migrator) Migrate2to3(ctx sdk.Context) error

Migrate2to3 migrates from version 2 to 3.

func (Migrator) Migrate3to4

func (m Migrator) Migrate3to4(ctx sdk.Context) error

Migrate3to4 migrates from version 3 to 4.

Jump to

Keyboard shortcuts

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