fb

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: GPL-3.0 Imports: 11 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 FBStruct2Data

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

Types

type FBCommunity

type FBCommunity struct {
	Note            *core.QContent  `json:"note"`
	DefineSigHex    string          `json:"define"`
	CreatorAddrHex  string          `json:"creator"`
	MinCosignCnt    int             `json:"minCosignCnt"`
	MaxInviteCnt    int             `json:"maxInviteCnt"`
	InitMembersHex  []string        `json:"initMembers"`
	Members         map[string]bool `json:"members"`
	InviteCnt       map[string]int  `json:"inviteCnt"`
	CreateTimestamp int64           `json:"createTime"`
	UpdateTimestamp int64           `json:"updateTime"`
}

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 {
	AddrHex         string                    `json:"address"`
	LastSigHex      string                    `json:"last"` // last sig of quantum
	LastSelfSeq     int64                     `json:"lseq"` // last self sequance
	Profile         map[string]*core.QContent `json:"profile,omitempty"`
	ReadableProfile map[string]*FBContent     `json:"rp,omitempty"`
	Attitude        *core.Attitude            `json:"attitude"`
	CreateTimestamp int64                     `json:"createTime"`
	UpdateTimestamp int64                     `json:"updateTime"`
}

func Data2FBIndividual

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

type FBQuantum

type FBQuantum struct {
	Received        []byte           `json:"recv,omitempty"`
	Origin          []byte           `json:"origin,omitempty"`
	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"`
	SigHex          string           `json:"sig,omitempty"`
	ReadableCS      []*FBContent     `json:"rcs,omitempty"`
	CreateTimestamp int64            `json:"createTime"`
	Trash           []byte           `json:"trash,omitempty"`
	Ignore          []byte           `json:"ignore,omitempty"`
	ManualIgnore    []byte           `json:"manualIgnore,omitempty"`
}

func Data2FBQuantum

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

func NewFBQuantum added in v0.3.1

func NewFBQuantum(q *core.Quantum) (*FBQuantum, error)

func NewFBQuantumFromDB added in v0.3.1

func NewFBQuantumFromDB(sig core.Sig, collect *firestore.CollectionRef, ctx context.Context) (*FBQuantum, error)

func NewFBQuantumFromSnap added in v0.3.1

func NewFBQuantumFromSnap(docSnapshot *firestore.DocumentSnapshot) (*FBQuantum, error)

func (*FBQuantum) GetOriginQuantum added in v0.3.1

func (fbq *FBQuantum) GetOriginQuantum() (*core.Quantum, error)

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) GetQuantums added in v0.3.1

func (fbu *FBUniverse) GetQuantums(limit int, skip int, desc bool) ([]*core.Quantum, error)

GetQuantums is not belong to interface of core/universe this function can be used to backup data by node owner or download data from node by user

func (*FBUniverse) HideProcessedQuantum added in v0.3.1

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

HideProcessedQuantum is not belong to interface of PDU Universe. In PDU system, each quantum is public and can not be completely removed from system, this function is just for convenience.

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) ProcessQuantums added in v0.3.1

func (fbu *FBUniverse) ProcessQuantums(limit, skip 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) QueryIndividuals added in v0.3.1

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

func (*FBUniverse) QueryQuantums added in v0.3.1

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

func (*FBUniverse) ReceiveQuantums added in v0.3.1

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

type UniverseStatus

type UniverseStatus struct {
	Sequence        int64  `json:"lastSequence,omitempty"`
	SigHex          string `json:"lastSigHex,omitempty"`
	UpdateTimestamp int64  `json:"updateTime"`
}

Jump to

Keyboard shortcuts

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