simulation

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpWeightMsgCreatePost       = "op_weight_msg_create_post"
	OpWeightMsgEditPost         = "op_weight_msg_edit_post"
	OpWeightMsgAddReaction      = "op_weight_msg_add_reaction"
	OpWeightMsgRemoveReaction   = "op_weight_msg_remove_reaction"
	OpWeightMsgAnswerPoll       = "op_weight_msg_answer_poll"
	OpWeightMsgRegisterReaction = "op_weight_msg_register_reaction"

	DefaultGasValue = 5000000
)

Simulation operation weights constants

Variables

View Source
var (
	RandomMimeTypes = []string{"audio/aac", "application/x-bzip2", "audio/ogg", "image/webp", "image/png"}
	RandomHosts     = []string{"https://example.com/", "https://ipfs.ink/"}
)

Functions

func DecodeStore

func DecodeStore(cdc *codec.Codec, kvA, kvB kv.Pair) string

DecodeStore unmarshals the KVPair's Reaction to the corresponding posts type

func GetAccount

func GetAccount(address sdk.Address, accs []sim.Account) *sim.Account

GetAccount gets the account having the given address from the accs list

func RandomHashtag added in v0.4.0

func RandomHashtag(r *rand.Rand) string

RandomHashtag returns a random hashtag from the above random hashtags

func RandomMedias

func RandomMedias(r *rand.Rand) types.PostMedias

RandomMedias returns a randomly generated list of post medias

func RandomMessage

func RandomMessage(r *rand.Rand) string

RandomMessage returns a random post message from the above random lorem phrases

func RandomPollData

func RandomPollData(r *rand.Rand) *types.PollData

RandomPollData returns a randomly generated poll data

func RandomPost

func RandomPost(r *rand.Rand, posts types.Posts) (types.Post, int)

RandomPost picks and returns a random post from an array and returns its position in the array.

func RandomPostID

func RandomPostID(r *rand.Rand, posts []types.Post) types.PostID

RandomPostID returns a randomly extracted post id from the list of posts given

func RandomPostReactionValue added in v0.4.0

func RandomPostReactionValue(r *rand.Rand) string

RandomPostReactionValue returns a random reaction value

func RandomReactionShortCode added in v0.4.0

func RandomReactionShortCode(r *rand.Rand) string

RandomReactionShortCode return a random reaction shortCode

func RandomReactionValue

func RandomReactionValue(r *rand.Rand) string

RandomReactionValue returns a random reaction value

func RandomSubspace

func RandomSubspace(r *rand.Rand) string

RandomSubspace returns a random post subspace from the above random subspaces

func RandomizedGenState

func RandomizedGenState(simState *module.SimulationState)

RandomizedGenState generates a random GenesisState for auth

func SimulateMsgAddPostReaction added in v0.4.0

func SimulateMsgAddPostReaction(k keeper.Keeper, ak auth.AccountKeeper) sim.Operation

SimulateMsgAddPostReaction tests and runs a single msg add reaction where the reacting user account already exists nolint: funlen

func SimulateMsgAnswerToPoll

func SimulateMsgAnswerToPoll(k keeper.Keeper, ak auth.AccountKeeper) sim.Operation

SimulateMsgAnswerToPoll tests and runs a single msg poll answer where the answering user account already exists nolint: funlen

func SimulateMsgCreatePost

func SimulateMsgCreatePost(k keeper.Keeper, ak auth.AccountKeeper) sim.Operation

SimulateMsgCreatePost tests and runs a single msg create post where the post creator account already exists nolint: funlen

func SimulateMsgEditPost

func SimulateMsgEditPost(k keeper.Keeper, ak auth.AccountKeeper) sim.Operation

SimulateMsgEditPost tests and runs a single msg edit post where the post creator account already exists nolint: funlen

func SimulateMsgRegisterReaction added in v0.4.0

func SimulateMsgRegisterReaction(k keeper.Keeper, ak auth.AccountKeeper) sim.Operation

SimulateMsgRegisterReaction tests and runs a single msg register reaction where the registering user account already exist nolint: funlen

func SimulateMsgRemovePostReaction added in v0.4.0

func SimulateMsgRemovePostReaction(k keeper.Keeper, ak auth.AccountKeeper) sim.Operation

SimulateMsgRemovePostReaction tests and runs a single msg remove reaction where the reacting user account already exists nolint: funlen

func WeightedOperations

func WeightedOperations(appParams sim.AppParams, cdc *codec.Codec, k keeper.Keeper, ak auth.AccountKeeper) sim.WeightedOperations

WeightedOperations returns all the operations from the module with their respective weights

Types

type PostData

type PostData struct {
	Creator        sim.Account
	ParentID       types.PostID
	Message        string
	AllowsComments bool
	Subspace       string
	CreationDate   time.Time
	OptionalData   map[string]string
	Medias         types.PostMedias
	PollData       *types.PollData
}

PostData contains the randomly generated data of a post

func RandomPostData

func RandomPostData(r *rand.Rand, accs []sim.Account) PostData

RandomPostData returns a randomly generated PostData based on the given random and accounts list

type PostReactionData added in v0.4.0

type PostReactionData struct {
	Value  string
	User   sim.Account
	PostID types.PostID
}

PostReactionData contains all the data needed for a post reaction to be properly added or removed from a post

func RandomPostReactionData added in v0.4.0

func RandomPostReactionData(r *rand.Rand, accs []sim.Account, postID types.PostID, shortCode string) PostReactionData

RandomPostReactionData returns a randomly generated post reaction data object

type ReactionData

type ReactionData struct {
	Creator   sim.Account
	ShortCode string
	Value     string
	Subspace  string
}

RegisteredReactionData contains all the data needed for a registered reaction to be properly registered

func RandomReactionData

func RandomReactionData(r *rand.Rand, accs []sim.Account) ReactionData

RandomReactionData returns a randomly generated reaction data object

func RegisteredReactionsData added in v0.4.0

func RegisteredReactionsData(r *rand.Rand, accs []sim.Account) []ReactionData

RegisteredReactionsData returns all the possible registered reactions with given data

Jump to

Keyboard shortcuts

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