votingutil

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VotingTypes

func VotingTypes() []string

Types

type Candidate

type Candidate struct {
	Name    string
	Group   string
	Url     string
	Image   []byte
	ImgName string
}

type Config

type Config struct {
	Title      string
	Time       *util.TimeInfo
	Salt1      string
	Salt2      []byte
	Candidates []*Candidate
	ManPriCid  string
	PubKey     evutil.IPubKey
	Params     *VoteParams
	Type       VotingType
	HkmAddr    string
	IvmAddr    string
	Labels     []string
}

func (*Config) CandNameGroups

func (cfg *Config) CandNameGroups() []string

func (*Config) FromCid

func (cfg *Config) FromCid(vCfgCid string, is ipfs.Ipfs) error

func (Config) Marshal

func (cfg Config) Marshal() []byte

func (*Config) ShuffleCandidates

func (cfg *Config) ShuffleCandidates()

func (*Config) Unmarshal

func (cfg *Config) Unmarshal(m []byte) error

type ManIdentity

type ManIdentity struct {
	Priv evutil.IPriKey
}

func (*ManIdentity) FromString

func (mi *ManIdentity) FromString(addr string) error

func (ManIdentity) Marshal

func (mi ManIdentity) Marshal() []byte

func (*ManIdentity) Unmarshal

func (mi *ManIdentity) Unmarshal(m []byte) error

type UserKeyPair

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

func NewUserKeyPair

func NewUserKeyPair() *UserKeyPair

func (UserKeyPair) Marshal

func (ukp UserKeyPair) Marshal() []byte

func (UserKeyPair) Sign

func (ukp UserKeyPair) Sign() evutil.ISignKey

func (*UserKeyPair) Unmarshal

func (ukp *UserKeyPair) Unmarshal(m []byte) error

func (UserKeyPair) Verify

func (ukp UserKeyPair) Verify() evutil.IVerfKey

type VoteInt

type VoteInt map[string]int

func (VoteInt) Marshal

func (vi VoteInt) Marshal() []byte

func (*VoteInt) Unmarshal

func (vi *VoteInt) Unmarshal(m []byte) error

type VoteParams

type VoteParams struct {
	Min   int
	Max   int
	Total int
}

type VoteResult

type VoteResult map[string]map[string]int

type VotingStores added in v0.3.0

type VotingStores struct {
	Is  ipfs.Ipfs
	Hkm crdt.ISignatureStore          //with access
	Ivm crdt.IUpdatableSignatureStore //with access
}

func NewConfig

func NewConfig(title, rCfgAddr string, tInfo *util.TimeInfo, cands []*Candidate, vParam *VoteParams, vType VotingType) (string, string, *VotingStores, error)

func (*VotingStores) Close added in v0.3.0

func (vs *VotingStores) Close()

type VotingType

type VotingType int
const (
	Single VotingType = iota
	Block
	Approval
	Range
	Preference
	Cumulative
)

func VotingTypeFromStr

func VotingTypeFromStr(str string) (VotingType, error)

func (VotingType) VotingType2String

func (vt VotingType) VotingType2String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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