keeper

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

NewHandler returns a handler for "magpie" type messages.

func NewQuerier

func NewQuerier(keeper Keeper) 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 ValidReportsIDs

func ValidReportsIDs(k Keeper) sdk.Invariant

ValidReportsIDs checks that all reports are associated with a valid postID that correspond to an existent post

Types

type Keeper

type Keeper struct {
	PostKeeper postsK.Keeper // Post's keeper to perform checks on the postIDs
	StoreKey   sdk.StoreKey  // Unexposed key to access store from sdk.Context
	Cdc        *codec.Codec  // The wire codec for binary encoding/decoding.
}

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

func NewKeeper

func NewKeeper(pk postsK.Keeper, cdc *codec.Codec, storeKey sdk.StoreKey) Keeper

NewKeeper creates new instances of the reports Keeper

func (Keeper) CheckPostExistence

func (k Keeper) CheckPostExistence(ctx sdk.Context, postID posts.PostID) bool

CheckPostExistence checks if a post with the given postID is present inside the current context and returns a boolean indicating that.

func (Keeper) GetPostReports

func (k Keeper) GetPostReports(ctx sdk.Context, postID posts.PostID) (reports types.Reports)

GetPostReports returns the list of reports associated with the given postID. If no reports is associated with the given postID the function will returns an empty list.

func (Keeper) GetReportsMap

func (k Keeper) GetReportsMap(ctx sdk.Context) map[string]types.Reports

GetReportsMap allows to returns the list of reports that have been stored inside the given context

func (Keeper) SaveReport

func (k Keeper) SaveReport(ctx sdk.Context, postID posts.PostID, report types.Report)

SaveReport allows to save the given reports inside the current context. It assumes that the given reports has already been validated. If the same reports has already been inserted, nothing will be changed.

Jump to

Keyboard shortcuts

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