fb

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CS2Readable

func CS2Readable(contents interface{}) (interface{}, error)

func Content2Readable

func Content2Readable(content *core.QContent) (map[string]interface{}, error)

func FBCommunity2Community

func FBCommunity2Community(uid string, fbc *FBCommunity) (*core.Community, error)

func FBIndividual2Individual

func FBIndividual2Individual(uid string, fbi *FBIndividual) (*core.Individual, error)

func FBQuantum2Quantum

func FBQuantum2Quantum(uid string, fbq *FBQuantum) (*core.Quantum, error)

func FBStruct2Data

func FBStruct2Data(fbstruct interface{}) (map[string]interface{}, error)

Types

type FBCommunity

type FBCommunity struct {
	Note           *core.QContent  `json:"note"`
	CreatorAddrHex string          `json:"creator"`
	MinCosignCnt   int             `json:"minCosignCnt"`
	MaxInviteCnt   int             `json:"maxInviteCnt"`
	InitMembersHex []string        `json:"initMembers,omitempty"`
	Members        map[string]bool `json:"members,omitempty"`
	InviteCnt      map[string]int  `json:"inviteCnt,omitempty"`
}

func Data2FBCommunity

func Data2FBCommunity(d map[string]interface{}) (*FBCommunity, error)

type FBContent

type FBContent struct {
	Data   interface{} `json:"data,omitempty"`
	Format int         `json:"fmt"`
}

type FBIndividual

type FBIndividual struct {
	LastSigHex  string                    `json:"last"` // last sig of quantum
	LastSelfSeq int64                     `json:"lseq"` // last self sequance
	Profile     map[string]*core.QContent `json:"profile,omitempty"`
	Attitude    *core.Attitude            `json:"attitude"`
}

func Data2FBIndividual

func Data2FBIndividual(d map[string]interface{}) (*FBIndividual, error)

type FBQuantum

type FBQuantum struct {
	Contents   []*core.QContent `json:"cs,omitempty"`
	Type       int              `json:"type"`
	FBRef      []*FBSig         `json:"refs"`
	Sequence   int64            `json:"seq,omitempty"`
	SelfSeq    int64            `json:"sseq,omitempty"`
	AddrHex    string           `json:"address,omitempty"`
	ReadableCS []*FBContent     `json:"rcs,omitempty"`
}

func Data2FBQuantum

func Data2FBQuantum(d map[string]interface{}) (*FBQuantum, error)

func Quantum2FBQuantum

func Quantum2FBQuantum(q *core.Quantum) (string, *FBQuantum)

type FBSig

type FBSig struct {
	SigHex string `json:"refs"`
}

type FBUniverse

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

func NewFBUniverse

func NewFBUniverse(ctx context.Context, keyFilename string, projectID string) (*FBUniverse, error)

func (*FBUniverse) Close

func (fbu *FBUniverse) Close() error

func (*FBUniverse) GetCommunity

func (fbu *FBUniverse) GetCommunity(sig core.Sig) (*core.Community, error)

func (*FBUniverse) GetIndividual

func (fbu *FBUniverse) GetIndividual(address identity.Address) (*core.Individual, error)

func (*FBUniverse) GetQuantum

func (fbu *FBUniverse) GetQuantum(sig core.Sig) (*core.Quantum, error)

func (*FBUniverse) JudgeCommunity

func (fbu *FBUniverse) JudgeCommunity(sig core.Sig, level int, statement string) error

func (*FBUniverse) JudgeIndividual

func (fbu *FBUniverse) JudgeIndividual(address identity.Address, level int, judgment string, evidence ...[]core.Sig) error

func (*FBUniverse) ProcessQuantum

func (fbu *FBUniverse) ProcessQuantum(skip, limit int) (accept []core.Sig, wait []core.Sig, reject []core.Sig, err error)

func (*FBUniverse) ProcessSingleQuantum

func (fbu *FBUniverse) ProcessSingleQuantum(sig core.Sig) error

func (*FBUniverse) QueryIndividual

func (fbu *FBUniverse) QueryIndividual(sig core.Sig, skip int, limit int, desc bool) ([]*core.Individual, error)

func (*FBUniverse) QueryQuantum

func (fbu *FBUniverse) QueryQuantum(address identity.Address, qType int, skip int, limit int, desc bool) ([]*core.Quantum, error)

func (*FBUniverse) ReceiveQuantum

func (fbu *FBUniverse) ReceiveQuantum(originQuantums []*core.Quantum) (accept []core.Sig, wait []core.Sig, reject []core.Sig, err error)

type UniverseStatus

type UniverseStatus struct {
	Sequence int64 `json:"universeSequence,omitempty"`
}

Jump to

Keyboard shortcuts

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