repo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ChProtocolBase is the prefix used for all possbile channel protocols.
	ChProtocolBase = "ch/"

	// ChProtocolStd prefixes channel protocols that operate generically and use default entry handling/processing.
	ChProtocolStd = ChProtocolBase + "std/"

	// ChProtocolReserved prefixes reserved/special channel protocols.
	ChProtocolReserved = ChProtocolBase + "_/"

	// Used internally and externally in PLAN
	ChProtocolACC             = ChProtocolReserved + "ACC"
	ChProtocolMemberRegistry  = ChProtocolReserved + "MemberRegistry"
	ChProtocolCommunityEpochs = ChProtocolReserved + "CommunityEpochs"

	// See plan-protobufs/pkg/ch
	ChProtocolSpace = ChProtocolStd + "Space"
	ChProtocolLinks = ChProtocolStd + "Links"
)

ChProtocol are common and built-in

Variables

View Source
var (
	ErrInvalidLengthRepo = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRepo   = fmt.Errorf("proto: integer overflow")
)
View Source
var ChSessionFlags_name = map[int32]string{
	0: "INCLUDE_BODY",
	1: "DEFERRED_ENTRIES",
	2: "CONTENT_ENTRIES",
	3: "NEW_EPOCH_ENTRIES",
}
View Source
var ChSessionFlags_value = map[string]int32{
	"INCLUDE_BODY":      0,
	"DEFERRED_ENTRIES":  1,
	"CONTENT_ENTRIES":   2,
	"NEW_EPOCH_ENTRIES": 3,
}
View Source
var EntryFlag_name = map[int32]string{
	0: "WELL_FORMED",
	1: "AUTHOR_DEPENDENCY_WRITTEN",
	2: "ACC_DEPENDENCY_WRITTEN",
	3: "GENESIS_ENTRY_VERIFIED",
	4: "IS_CHANNEL_GENESIS",
}
View Source
var EntryFlag_value = map[string]int32{
	"WELL_FORMED":               0,
	"AUTHOR_DEPENDENCY_WRITTEN": 1,
	"ACC_DEPENDENCY_WRITTEN":    2,
	"GENESIS_ENTRY_VERIFIED":    3,
	"IS_CHANNEL_GENESIS":        4,
}
View Source
var EntryStatus_name = map[int32]string{
	0: "DISBARRED",
	1: "AWAITING_MERGE",
	2: "MERGED",
	3: "DEFERRED",
	4: "LIVE",
}
View Source
var EntryStatus_value = map[string]int32{
	"DISBARRED":      0,
	"AWAITING_MERGE": 1,
	"MERGED":         2,
	"DEFERRED":       3,
	"LIVE":           4,
}
View Source
var MsgOp_name = map[int32]string{
	0:  "OK",
	1:  "ADD_COMMUNITY_KEYS",
	2:  "RETAIN_COMMUNITY_KEYS",
	3:  "COMMIT_TXNS",
	4:  "LATEST_CH_INFO",
	5:  "LATEST_CH_EPOCH",
	6:  "START_CH_SESSION",
	7:  "MEMBER_SESSION_READY",
	8:  "COMMIT_TXNS_COMPLETE",
	9:  "CH_GENESIS_ENTRY",
	10: "CLOSE_CH_SESSION",
	11: "POST_CH_ENTRY",
	12: "RESET_ENTRY_READER",
	13: "RESERVED_13",
	14: "RESERVED_14",
	15: "CH_SESSION_CLOSED",
	16: "CH_ENTRY",
	17: "CH_ENTRY_UPDATE",
	18: "CH_NEW_ENTRY_READY",
	19: "RESERVED_19",
	20: "RESERVED_20",
	21: "LOGIN_TO_WS_SEAT",
}
View Source
var MsgOp_value = map[string]int32{
	"OK":                    0,
	"ADD_COMMUNITY_KEYS":    1,
	"RETAIN_COMMUNITY_KEYS": 2,
	"COMMIT_TXNS":           3,
	"LATEST_CH_INFO":        4,
	"LATEST_CH_EPOCH":       5,
	"START_CH_SESSION":      6,
	"MEMBER_SESSION_READY":  7,
	"COMMIT_TXNS_COMPLETE":  8,
	"CH_GENESIS_ENTRY":      9,
	"CLOSE_CH_SESSION":      10,
	"POST_CH_ENTRY":         11,
	"RESET_ENTRY_READER":    12,
	"RESERVED_13":           13,
	"RESERVED_14":           14,
	"CH_SESSION_CLOSED":     15,
	"CH_ENTRY":              16,
	"CH_ENTRY_UPDATE":       17,
	"CH_NEW_ENTRY_READY":    18,
	"RESERVED_19":           19,
	"RESERVED_20":           20,
	"LOGIN_TO_WS_SEAT":      21,
}

Functions

func RecycleChEntry

func RecycleChEntry(entry *chEntry)

RecycleChEntry should be used whenever a chEntry is no longer referenced (and whose parts can be reused)

func RegisterRepoServer

func RegisterRepoServer(s *grpc.Server, srv RepoServer)

Types

type ByEpochTID

type ByEpochTID []*ChEpochNode

ByEpochTID implements sort.Interface to sort a slice of ChEpochNodes by TID

func (ByEpochTID) Len

func (a ByEpochTID) Len() int

func (ByEpochTID) Less

func (a ByEpochTID) Less(i, j int) bool

func (ByEpochTID) Swap

func (a ByEpochTID) Swap(i, j int)

type ChACC

type ChACC struct {
	ChStdAgent
}

ChACC -- ChAgent for ChProtocolACC

func (*ChACC) MergePost

func (acc *ChACC) MergePost(
	entry *chEntry,
) error

MergePost -- see ChAgent.MergePost

type ChAgent

type ChAgent interface {
	OnStartup(chSt *ChStore) error

	OnLivenessChanged(
		entry *chEntry,
	) error

	MergePost(
		entry *chEntry,
	) error
}

ChAgent is a protocol-specific implementation built to interact with a ChStore

func NewChAgentFromProtocolStr

func NewChAgentFromProtocolStr(inChProtocol string) ChAgent

NewChAgentFromProtocolStr instantiates a new ChAgent that is associated with the given channel protocol string.

type ChAgentFactory

type ChAgentFactory func(inChProtocol string) ChAgent

ChAgentFactory is a ChAgent factory function. It returns a new ChAgent instance associated with the given channel protocol invocation.

type ChCommunityEpochs

type ChCommunityEpochs struct {
	ChStdAgent
	// contains filtered or unexported fields
}

ChCommunityEpochs ia a ChAgent that uses entries on a community epoch channel for entry validation.

func (*ChCommunityEpochs) FetchCommunityEpoch

func (ch *ChCommunityEpochs) FetchCommunityEpoch(inEpochID []byte, inLiveOnly bool) *pdi.CommunityEpoch

FetchCommunityEpoch returns the requested CommunityEpoch by TID.

func (*ChCommunityEpochs) LatestCommunityEpoch

func (ch *ChCommunityEpochs) LatestCommunityEpoch() *pdi.CommunityEpoch

LatestCommunityEpoch returns the most recent and live CommunityEpoch

func (*ChCommunityEpochs) MergePost

func (ch *ChCommunityEpochs) MergePost(entry *chEntry) error

MergePost -- see ChAgent.MergePost

func (*ChCommunityEpochs) OnLivenessChanged

func (ch *ChCommunityEpochs) OnLivenessChanged(
	entry *chEntry,
) error

OnLivenessChanged -- see ChAgent.OnLivenessChanged

func (*ChCommunityEpochs) OnStartup

func (ch *ChCommunityEpochs) OnStartup(chSt *ChStore) error

OnStartup -- see ChAgent.OnStartup

type ChDependency

type ChDependency struct {
	// Time index (and later) of applicable channel entries
	DepTime              int64    `protobuf:"varint,1,opt,name=dep_time,json=depTime,proto3" json:"dep_time,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChDependency) Descriptor

func (*ChDependency) Descriptor() ([]byte, []int)

func (*ChDependency) GetDepTime

func (m *ChDependency) GetDepTime() int64

func (*ChDependency) Marshal

func (m *ChDependency) Marshal() (dAtA []byte, err error)

func (*ChDependency) MarshalTo

func (m *ChDependency) MarshalTo(dAtA []byte) (int, error)

func (*ChDependency) ProtoMessage

func (*ChDependency) ProtoMessage()

func (*ChDependency) Reset

func (m *ChDependency) Reset()

func (*ChDependency) Size

func (m *ChDependency) Size() (n int)

func (*ChDependency) String

func (m *ChDependency) String() string

func (*ChDependency) Unmarshal

func (m *ChDependency) Unmarshal(dAtA []byte) error

func (*ChDependency) XXX_DiscardUnknown

func (m *ChDependency) XXX_DiscardUnknown()

func (*ChDependency) XXX_Marshal

func (m *ChDependency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChDependency) XXX_Merge

func (m *ChDependency) XXX_Merge(src proto.Message)

func (*ChDependency) XXX_Size

func (m *ChDependency) XXX_Size() int

func (*ChDependency) XXX_Unmarshal

func (m *ChDependency) XXX_Unmarshal(b []byte) error

type ChEpochNode

type ChEpochNode struct {
	Prev   *ChEpochNode
	Next   []*ChEpochNode
	Epoch  pdi.ChannelEpoch
	Status EntryStatus
}

ChEpochNode allows a tree to be made out of ChannelEpochs, facilitaing analysis.

type ChMemberRegistry

type ChMemberRegistry struct {
	ChStdAgent
	// contains filtered or unexported fields
}

ChMemberRegistry is a ChAgent that uses entries on the member registry channel to validate authorship of entries

func (*ChMemberRegistry) FetchMemberEpoch

func (reg *ChMemberRegistry) FetchMemberEpoch(inEntryID plan.TID) (*pdi.MemberEpoch, error)

FetchMemberEpoch returns the MemberEpoch associated with the given entry ID

func (*ChMemberRegistry) MergePost

func (reg *ChMemberRegistry) MergePost(entry *chEntry) error

MergePost -- see ChAgent.MergePost

func (*ChMemberRegistry) ValidateAuthor

func (reg *ChMemberRegistry) ValidateAuthor(
	entry *chEntry,
) error

ValidateAuthor looks up the given entry's author member and verifies that the entry's author sig matches the sig on record in this member registry.

type ChMgr

type ChMgr struct {
	ctx.Context

	HomePath string

	StorageEpoch pdi.StorageEpoch
	CR           *CommunityRepo
	// contains filtered or unexported fields
}

ChMgr is the top level interface for a community's channels.

func NewChMgr

func NewChMgr(
	inHomeDir string,
	CR *CommunityRepo,
) *ChMgr

NewChMgr creates and inits a new ChMgr instance.

func (*ChMgr) ChannelExists

func (chMgr *ChMgr) ChannelExists(
	inChID plan.ChID,
) (*ChStore, error)

ChannelExists returns the given channel, loading it if necessary. If the channel is not found, then it isn not autho

func (*ChMgr) FetchACC

func (chMgr *ChMgr) FetchACC(
	inChID plan.ChID,
) (*ChACC, error)

FetchACC returns the given channel known/presumed to be an ACC.

func (*ChMgr) FetchChannel

func (chMgr *ChMgr) FetchChannel(
	inChID plan.ChID,
) (*ChStore, error)

FetchChannel returns the owning ChAgent for the given channel ID. If inGenesisEpoch is set, channel genesis is performed.

func (*ChMgr) FetchCommunityEpochsChannel

func (chMgr *ChMgr) FetchCommunityEpochsChannel() *ChCommunityEpochs

FetchCommunityEpochsChannel returns the community's epoch channel

func (*ChMgr) FetchMemberRegistry

func (chMgr *ChMgr) FetchMemberRegistry() (*ChMemberRegistry, error)

FetchMemberRegistry returns the community's member registry channel

func (*ChMgr) QueueEntryForMerge

func (chMgr *ChMgr) QueueEntryForMerge(
	entryCommEpoch *pdi.CommunityEpoch,
	entry *chEntry,
)

QueueEntryForMerge is called when an entry arrives to a repo and must be merged into the repo.

func (*ChMgr) StartChannelSession

func (chMgr *ChMgr) StartChannelSession(
	inMemberSession *MemberSession,
	inChID plan.ChID,
) (*ChSession, error)

StartChannelSession instantiates a nre channel session for the given channel ID (and accompanying params)

func (*ChMgr) Startup

func (chMgr *ChMgr) Startup() error

Startup -- see plan.Flow.Startup()

type ChMgrState

type ChMgrState struct {
	// Incremented each time an entry is reversed/overturned.
	// This supports revalidation bookkeeping (triggered by a reversed entry)
	ValidationRev        int64    `protobuf:"varint,1,opt,name=validation_rev,json=validationRev,proto3" json:"validation_rev,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChMgrState) Descriptor

func (*ChMgrState) Descriptor() ([]byte, []int)

func (*ChMgrState) GetValidationRev

func (m *ChMgrState) GetValidationRev() int64

func (*ChMgrState) Marshal

func (m *ChMgrState) Marshal() (dAtA []byte, err error)

func (*ChMgrState) MarshalTo

func (m *ChMgrState) MarshalTo(dAtA []byte) (int, error)

func (*ChMgrState) ProtoMessage

func (*ChMgrState) ProtoMessage()

func (*ChMgrState) Reset

func (m *ChMgrState) Reset()

func (*ChMgrState) Size

func (m *ChMgrState) Size() (n int)

func (*ChMgrState) String

func (m *ChMgrState) String() string

func (*ChMgrState) Unmarshal

func (m *ChMgrState) Unmarshal(dAtA []byte) error

func (*ChMgrState) XXX_DiscardUnknown

func (m *ChMgrState) XXX_DiscardUnknown()

func (*ChMgrState) XXX_Marshal

func (m *ChMgrState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChMgrState) XXX_Merge

func (m *ChMgrState) XXX_Merge(src proto.Message)

func (*ChMgrState) XXX_Size

func (m *ChMgrState) XXX_Size() int

func (*ChMgrState) XXX_Unmarshal

func (m *ChMgrState) XXX_Unmarshal(b []byte) error

type ChSessID

type ChSessID uint32

ChSessID identifies a sub session within/under MemberSession, the obj associated with a client that is connected.

type ChSession

type ChSession struct {
	ctx.Context

	ChSessID ChSessID

	// Parent member session
	MemberSession *MemberSession
	// contains filtered or unexported fields
}

ChSession instances correspond to client rpc calls to StartChannelSession().

A ChSession is the bridge between a ChAgent and a MemberSession

func (*ChSession) AuthorNewEntry

func (cs *ChSession) AuthorNewEntry(
	msg *Msg,
)

AuthorNewEntry recycles the given repo.Msg, seting its EntryInfo so that it's compliant with the latest ChannelEpoch from the channel associated with this ChSession.

type ChSessionFlags

type ChSessionFlags int32
const (
	// If set, entry bodies will be included
	ChSessionFlags_INCLUDE_BODY ChSessionFlags = 0
	// IF set, entries that are deferred (in addition to live entries) are included.
	ChSessionFlags_DEFERRED_ENTRIES ChSessionFlags = 1
	// If set, entries with op type EntryOp_POST_CONTENT will be sent
	ChSessionFlags_CONTENT_ENTRIES ChSessionFlags = 2
	// If set, entries with op type EntryOp_NEW_CHANNEL_EPOCH will be sent.
	ChSessionFlags_NEW_EPOCH_ENTRIES ChSessionFlags = 3
)

func (ChSessionFlags) EnumDescriptor

func (ChSessionFlags) EnumDescriptor() ([]byte, []int)

func (ChSessionFlags) String

func (x ChSessionFlags) String() string

type ChStdAgent

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

ChStdAgent is a foundation/base"for a ChAgent that operates genically.

func (*ChStdAgent) MergePost

func (std *ChStdAgent) MergePost(
	entry *chEntry,
) error

MergePost -- see ChAgent interface

func (*ChStdAgent) OnLivenessChanged

func (std *ChStdAgent) OnLivenessChanged(
	entry *chEntry,
) error

OnLivenessChanged -- see ChAgent interface

func (*ChStdAgent) OnStartup

func (std *ChStdAgent) OnStartup(chSt *ChStore) error

OnStartup -- see ChAgent interface

type ChStore

type ChStore struct {
	ctx.Logger

	State          ChStoreState
	StateRevOnDisk int64
	// contains filtered or unexported fields
}

ChStore is the low-level channel entry manager for a channel.

func (*ChStore) AddDependency

func (chSt *ChStore) AddDependency(
	inRefdTID plan.TID,
	inDepChID plan.ChID,
	inDepEntry *pdi.EntryInfo,
) error

AddDependency adds the given dependency, storing a state such that subsequent entries posted to reverted to this channel

can cause dependent channels to commence relvalidation.

func (*ChStore) ChID

func (chSt *ChStore) ChID() plan.ChID

ChID returns the channel ID for this ChStore

func (*ChStore) ExportLatestChEpoch

func (chSt *ChStore) ExportLatestChEpoch(recycle []byte) []byte

ExportLatestChEpoch marshals the latest pdi.ChannelEpoch (recycling the given buf if possible)

func (*ChStore) ExportLatestChInfo

func (chSt *ChStore) ExportLatestChInfo(recycle []byte) []byte

ExportLatestChInfo constructs the most up to date pdi.ChInfo and serializes it (recycling the given buf if possible)

func (*ChStore) FetchAuthoringTIDs

func (chSt *ChStore) FetchAuthoringTIDs(
	outChEpochTID plan.TID,
	outACCEntryTID plan.TID,
) error

FetchAuthoringTIDs fills in the TIDs that a newly authored entry should use.

func (*ChStore) FetchChEpoch

func (chSt *ChStore) FetchChEpoch(
	inEntryID plan.TID,
) *ChEpochNode

FetchChEpoch returns the ChEpochNode associated with the given entry TID (or nil)

func (*ChStore) GetActiveChEpoch

func (chSt *ChStore) GetActiveChEpoch() *ChEpochNode

GetActiveChEpoch returns the most recent and live channel epoch posted to this channel

func (*ChStore) IsEntryAuthorized

func (chSt *ChStore) IsEntryAuthorized(
	inCitedEpoch plan.TID,
	entry *chEntry,
) error

IsEntryAuthorized returns no error only if the cited channel epoch (and implied epoch chain) authorizes this entry.

func (*ChStore) Log

func (chSt *ChStore) Log(inErr error, inMsg string)

Log is a convenience function to log errors. This function has no effect if inErr == nil.

func (*ChStore) MergeNewChannelEpoch

func (chSt *ChStore) MergeNewChannelEpoch(
	entry *chEntry,
) error

MergeNewChannelEpoch -- see ChAgent.MergeNewChannelEpoch

func (*ChStore) MergePost

func (chSt *ChStore) MergePost(
	entry *chEntry,
) error

MergePost -- see ChAgent.MergePost

func (*ChStore) NewWrite

func (chSt *ChStore) NewWrite() *badger.Txn

NewWrite -- see ChAgent.NewWrite

func (*ChStore) OnLivenessChanged

func (chSt *ChStore) OnLivenessChanged(
	entry *chEntry,
) error

OnLivenessChanged -- see ChAgent.MergePost

func (*ChStore) ReadyToMerge

func (chSt *ChStore) ReadyToMerge() bool

ReadyToMerge returns true if the ChStore is able to read and merge entries (which is only possible if a channel protocol is set)

func (*ChStore) RevalidateDependencies

func (chSt *ChStore) RevalidateDependencies(
	chEntry *pdi.EntryInfo,
)

RevalidateDependencies queues revalidation for all possible dependencies for the given entry.

Pre: inChEntry has been posted to this channel.

func (*ChStore) RewindValidation

func (chSt *ChStore) RewindValidation(inAfterTime plan.TimeFS, inReason string)

RewindValidation queues all entries on or after the given time index for revalidation.

func (*ChStore) Shutdown

func (chSt *ChStore) Shutdown(inWait *sync.WaitGroup)

Shutdown initiates a channel shutdown and blocks until complete. If inWait is given, then this function will call inWait.Done() before exiting

func (*ChStore) ShutdownEntryProcessing

func (chSt *ChStore) ShutdownEntryProcessing(inBlockUntilComplete bool)

ShutdownEntryProcessing causes a ChStore's entry validation goroutine to exit.

func (*ChStore) Startup

func (chSt *ChStore) Startup() error

Startup -- see ChAgent.Startup()

func (*ChStore) ValidateAgainstEpochHistory

func (chSt *ChStore) ValidateAgainstEpochHistory(
	entry *chEntry,
) (epochNode *ChEpochNode, err error)

ValidateAgainstEpochHistory checks this channel's ChannelEpoch history to make sure the given entry is valid to go live.

func (*ChStore) ValidateEntry

func (chSt *ChStore) ValidateEntry(
	entry *chEntry,
)

ValidateEntry checks that the conditions needed for an entry to go live.

type ChStoreState

type ChStoreState struct {
	ChID []byte `protobuf:"bytes,1,opt,name=chID,proto3" json:"chID,omitempty"`
	// ChProtocol is the channel protocol identifying how clients should interpret content entries in this channel.
	// Its value and originates from this channel's genesis ChannelEpoch and is regarded as immutable.
	// If not set, then channel content entries arrived *before* the genesis ChannelEpoch and so the protocol is still unknown.
	ChProtocol string `protobuf:"bytes,2,opt,name=ch_protocol,json=chProtocol,proto3" json:"ch_protocol,omitempty"`
	// This identifies what agent type/class last maintained this channel (or empty if no agent has ever been assigned).
	// This exists so that if/when a different agent is assigned, it can be used to trigger full channel revalidation.
	AssignedAgentID string `protobuf:"bytes,3,opt,name=assigned_agentID,json=assignedAgentID,proto3" json:"assigned_agentID,omitempty"`
	// All entry TIDs up to this point (and including this TID) are not pending active validation.
	ValidatedUpto []byte `protobuf:"bytes,10,opt,name=validated_upto,json=validatedUpto,proto3" json:"validated_upto,omitempty"`
	// Incremented every time ValidatedUpto is moved backward in time (when additional entries need to be revalidated)
	Rev                  int64    `protobuf:"varint,11,opt,name=rev,proto3" json:"rev,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChStoreState) Descriptor

func (*ChStoreState) Descriptor() ([]byte, []int)

func (*ChStoreState) GetAssignedAgentID

func (m *ChStoreState) GetAssignedAgentID() string

func (*ChStoreState) GetChID

func (m *ChStoreState) GetChID() []byte

func (*ChStoreState) GetChProtocol

func (m *ChStoreState) GetChProtocol() string

func (*ChStoreState) GetRev

func (m *ChStoreState) GetRev() int64

func (*ChStoreState) GetValidatedUpto

func (m *ChStoreState) GetValidatedUpto() []byte

func (*ChStoreState) Marshal

func (m *ChStoreState) Marshal() (dAtA []byte, err error)

func (*ChStoreState) MarshalTo

func (m *ChStoreState) MarshalTo(dAtA []byte) (int, error)

func (*ChStoreState) ProtoMessage

func (*ChStoreState) ProtoMessage()

func (*ChStoreState) Reset

func (m *ChStoreState) Reset()

func (*ChStoreState) Size

func (m *ChStoreState) Size() (n int)

func (*ChStoreState) String

func (m *ChStoreState) String() string

func (*ChStoreState) Unmarshal

func (m *ChStoreState) Unmarshal(dAtA []byte) error

func (*ChStoreState) XXX_DiscardUnknown

func (m *ChStoreState) XXX_DiscardUnknown()

func (*ChStoreState) XXX_Marshal

func (m *ChStoreState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChStoreState) XXX_Merge

func (m *ChStoreState) XXX_Merge(src proto.Message)

func (*ChStoreState) XXX_Size

func (m *ChStoreState) XXX_Size() int

func (*ChStoreState) XXX_Unmarshal

func (m *ChStoreState) XXX_Unmarshal(b []byte) error

type CommunityCrypto

type CommunityCrypto struct {
	RetainUpto int64
	Keys       ski.Session
}

CommunityCrypto wraps a community keyring session.

func (*CommunityCrypto) CommunityEncrypt

func (cc *CommunityCrypto) CommunityEncrypt(
	inBuf []byte,
	inKeyRef *ski.KeyRef,
) ([]byte, error)

CommunityEncrypt encrypts the given buffer with the given community key ref (presumed ot be a symmetric key).

func (*CommunityCrypto) EndSession

func (cc *CommunityCrypto) EndSession(
	inReason string,
)

EndSession ends this

type CommunityRepo

type CommunityRepo struct {
	ctx.Context

	GenesisSeed     GenesisSeed
	Config          *Config
	HomePath        string
	DefaultFileMode os.FileMode
	State           CommunityRepoState
	// contains filtered or unexported fields
}

CommunityRepo wraps a community's data repository and responds to queries for the given community.

func NewCommunityRepo

func NewCommunityRepo(
	inHomePath string,
	inSeed *RepoSeed,
) (*CommunityRepo, error)

NewCommunityRepo creates a CommunityRepo for use.

If inSeed is set, this repo is being instantiated for the first time

func (*CommunityRepo) DecryptAndMergeEntry

func (CR *CommunityRepo) DecryptAndMergeEntry(entry *chEntry) error

DecryptAndMergeEntry decrypts the given entry and then merges it with this repo.

If an error is returned, it means the entry is malformed (and never can be merged).

func (*CommunityRepo) FetchCommunityEpoch

func (CR *CommunityRepo) FetchCommunityEpoch(inEpochID []byte, inLiveOnly bool) *pdi.CommunityEpoch

FetchCommunityEpoch returns the CommunityEpoch with the matching epoch ID

func (*CommunityRepo) GenesisSeedPathname

func (CR *CommunityRepo) GenesisSeedPathname() string

GenesisSeedPathname returns the pathname of the signed genesis seed.

func (*CommunityRepo) LatestCommunityEpoch

func (CR *CommunityRepo) LatestCommunityEpoch() *pdi.CommunityEpoch

LatestCommunityEpoch -- see interface MemberHost

func (*CommunityRepo) LatestStorageEpoch

func (CR *CommunityRepo) LatestStorageEpoch() pdi.StorageEpoch

LatestStorageEpoch -- see interface MemberHost

func (*CommunityRepo) OpenMemberSession

func (CR *CommunityRepo) OpenMemberSession(
	inSessReq *MemberSessionReq,
	inMsgOutlet Repo_OpenMemberSessionServer,
) (*MemberSession, error)

OpenMemberSession starts a new session for the given member

func (*CommunityRepo) Startup

func (CR *CommunityRepo) Startup() error

Startup starts this repo

type CommunityRepoState

type CommunityRepoState struct {
	LastTxnTimeRead int64               `json:"last_txn_time_read"` // Unix timpesamp where repo should resume reading a community StorageProvider
	Services        []*plan.ServiceInfo `json:"services"`
}

CommunityRepoState stores repo state

type Config

type Config struct {

	// Number of storage provider faults/errors before this repo disconnects and requires manual override
	MaxStorageProviderFaults int32 `json:"max_storage_provider_faults"`

	// Number of seconds the sync scanner looks backward to look for txns it's missed
	ReverseScanStep int `json:"reverse_scan_step"`
}

Config are params needed in order to run/start a CommunityRepo TODO: where do these settings go? StorageEpoch

type EntryFlag

type EntryFlag int32

EntryFlags are bit shift values (not actual values)

const (
	// If not set, one or more parts of this entry are not self-consistent and/or do not self-validate.
	// By definition, once this flag is cleared, it will never reappear.
	EntryFlag_WELL_FORMED EntryFlag = 0
	// Set when this entry's author dependency has been written
	EntryFlag_AUTHOR_DEPENDENCY_WRITTEN EntryFlag = 1
	// Set when this entry's ACC dependency has been written
	EntryFlag_ACC_DEPENDENCY_WRITTEN EntryFlag = 2
	// Set if this entry's URID appears in the community's list of genesis entries.
	EntryFlag_GENESIS_ENTRY_VERIFIED EntryFlag = 3
	// Set if this entryOp == NEW_CHANNEL_EPOCH and has no previous channel epoch TID set.
	EntryFlag_IS_CHANNEL_GENESIS EntryFlag = 4
)

func (EntryFlag) EnumDescriptor

func (EntryFlag) EnumDescriptor() ([]byte, []int)

func (EntryFlag) String

func (x EntryFlag) String() string

type EntryState

type EntryState struct {
	Flags  uint32      `protobuf:"varint,1,opt,name=flags,proto3" json:"flags,omitempty"`
	Status EntryStatus `protobuf:"varint,2,opt,name=status,proto3,enum=repo.EntryStatus" json:"status,omitempty"`
	// IF len() == 0, the implied body TID is the same as the entry info's TID (done to save space)
	// When entry 1 is superseded by entry 2, entry 2's TID appears in entry 1's EntryState.
	LiveIDs              []byte   `protobuf:"bytes,10,opt,name=liveIDs,proto3" json:"liveIDs,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*EntryState) AddLiveID

func (state *EntryState) AddLiveID(inID plan.TID) bool

AddLiveID adds the given TID to the list of "live" IDs

func (*EntryState) Clone

func (state *EntryState) Clone() *EntryState

Clone instantiates a completely sepearate copy of this EntryState.

func (*EntryState) Descriptor

func (*EntryState) Descriptor() ([]byte, []int)

func (*EntryState) GetFlags

func (m *EntryState) GetFlags() uint32

func (*EntryState) GetLiveIDs

func (m *EntryState) GetLiveIDs() []byte

func (*EntryState) GetStatus

func (m *EntryState) GetStatus() EntryStatus

func (*EntryState) Marshal

func (m *EntryState) Marshal() (dAtA []byte, err error)

func (*EntryState) MarshalTo

func (m *EntryState) MarshalTo(dAtA []byte) (int, error)

func (*EntryState) ProtoMessage

func (*EntryState) ProtoMessage()

func (*EntryState) Reset

func (m *EntryState) Reset()

func (*EntryState) Size

func (m *EntryState) Size() (n int)

func (*EntryState) StrikeLiveID

func (state *EntryState) StrikeLiveID(inID plan.TID) bool

StrikeLiveID removes the given TID from the list of "live" IDs

func (*EntryState) String

func (m *EntryState) String() string

func (*EntryState) Unmarshal

func (m *EntryState) Unmarshal(dAtA []byte) error

func (*EntryState) XXX_DiscardUnknown

func (m *EntryState) XXX_DiscardUnknown()

func (*EntryState) XXX_Marshal

func (m *EntryState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EntryState) XXX_Merge

func (m *EntryState) XXX_Merge(src proto.Message)

func (*EntryState) XXX_Size

func (m *EntryState) XXX_Size() int

func (*EntryState) XXX_Unmarshal

func (m *EntryState) XXX_Unmarshal(b []byte) error

type EntryStatus

type EntryStatus int32
const (
	// The given entry has been confirmed to be associated with unauthorized activity, a security breach, or inappropriate behavior.
	EntryStatus_DISBARRED EntryStatus = 0
	// This entry has yet to merged into the repo's channel subsystem.
	EntryStatus_AWAITING_MERGE EntryStatus = 1
	// This entry has been merged into the channel.
	EntryStatus_MERGED EntryStatus = 2
	// The given entry is deferred as a result of one of many possibilities encountered during
	// channel entry validation (see design-docs/PLAN-Proof-of-correctness.md). Specifically,
	// this means EntryState.Flags lacks one or more req'd flags in order for the entry to be live.
	EntryStatus_DEFERRED EntryStatus = 3
	// The given entry is considered authentic and a live operating part of the local community repo.
	// The corresponding EntryState.Flags contains all the flags required for an entry to be live.
	EntryStatus_LIVE EntryStatus = 4
)

func (EntryStatus) EnumDescriptor

func (EntryStatus) EnumDescriptor() ([]byte, []int)

func (EntryStatus) String

func (x EntryStatus) String() string

type GenesisSeed

type GenesisSeed struct {
	StorageEpoch         *pdi.StorageEpoch   `protobuf:"bytes,1,opt,name=storage_epoch,json=storageEpoch,proto3" json:"storage_epoch,omitempty"`
	CommunityEpoch       *pdi.CommunityEpoch `protobuf:"bytes,2,opt,name=community_epoch,json=communityEpoch,proto3" json:"community_epoch,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

func ExtractAndVerifyGenesisSeed

func ExtractAndVerifyGenesisSeed(
	inSignedBuf []byte,
) (*GenesisSeed, error)

ExtractAndVerifyGenesisSeed unpacks, unmarshals, and verifies the GenesisSeed contained within the given buf

func LoadAndVerifyGenesisSeed

func LoadAndVerifyGenesisSeed(inSeedPathname string) (*GenesisSeed, error)

LoadAndVerifyGenesisSeed unpacks, unmarshals, and verifies the GenesisSeed packed into the given signed file

func (*GenesisSeed) Descriptor

func (*GenesisSeed) Descriptor() ([]byte, []int)

func (*GenesisSeed) FormSuggestedDirName

func (gs *GenesisSeed) FormSuggestedDirName() string

FormSuggestedDirName forms a file system friendly name that identifies this community to humans.

func (*GenesisSeed) GetCommunityEpoch

func (m *GenesisSeed) GetCommunityEpoch() *pdi.CommunityEpoch

func (*GenesisSeed) GetStorageEpoch

func (m *GenesisSeed) GetStorageEpoch() *pdi.StorageEpoch

func (*GenesisSeed) Marshal

func (m *GenesisSeed) Marshal() (dAtA []byte, err error)

func (*GenesisSeed) MarshalTo

func (m *GenesisSeed) MarshalTo(dAtA []byte) (int, error)

func (*GenesisSeed) ProtoMessage

func (*GenesisSeed) ProtoMessage()

func (*GenesisSeed) Reset

func (m *GenesisSeed) Reset()

func (*GenesisSeed) Size

func (m *GenesisSeed) Size() (n int)

func (*GenesisSeed) String

func (m *GenesisSeed) String() string

func (*GenesisSeed) Unmarshal

func (m *GenesisSeed) Unmarshal(dAtA []byte) error

func (*GenesisSeed) XXX_DiscardUnknown

func (m *GenesisSeed) XXX_DiscardUnknown()

func (*GenesisSeed) XXX_Marshal

func (m *GenesisSeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisSeed) XXX_Merge

func (m *GenesisSeed) XXX_Merge(src proto.Message)

func (*GenesisSeed) XXX_Size

func (m *GenesisSeed) XXX_Size() int

func (*GenesisSeed) XXX_Unmarshal

func (m *GenesisSeed) XXX_Unmarshal(b []byte) error

type MemberSeed

type MemberSeed struct {
	RepoSeed *RepoSeed `protobuf:"bytes,1,opt,name=repo_seed,json=repoSeed,proto3" json:"repo_seed,omitempty"`
	// Exported and exported ski.KeyTome containing all keys needed for the recipient member.
	KeyTome     []byte           `protobuf:"bytes,3,opt,name=key_tome,json=keyTome,proto3" json:"key_tome,omitempty"`
	MemberEpoch *pdi.MemberEpoch `protobuf:"bytes,6,opt,name=member_epoch,json=memberEpoch,proto3" json:"member_epoch,omitempty"`
	// WHO sent this invitation (note: the member's signing key is used to create this invite)
	OriginMemberID       uint64       `protobuf:"fixed64,7,opt,name=origin_memberID,json=originMemberID,proto3" json:"origin_memberID,omitempty"`
	OriginSigningKey     *ski.KeyInfo `protobuf:"bytes,8,opt,name=origin_signing_key,json=originSigningKey,proto3" json:"origin_signing_key,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

A community issues this to a person they want to invite into their community. A copy of this record is written to member registry channel. This is passed in the clear and is used by a prospective member or guest's client to connect to a community.

func (*MemberSeed) Descriptor

func (*MemberSeed) Descriptor() ([]byte, []int)

func (*MemberSeed) GetKeyTome

func (m *MemberSeed) GetKeyTome() []byte

func (*MemberSeed) GetMemberEpoch

func (m *MemberSeed) GetMemberEpoch() *pdi.MemberEpoch

func (*MemberSeed) GetOriginMemberID

func (m *MemberSeed) GetOriginMemberID() uint64

func (*MemberSeed) GetOriginSigningKey

func (m *MemberSeed) GetOriginSigningKey() *ski.KeyInfo

func (*MemberSeed) GetRepoSeed

func (m *MemberSeed) GetRepoSeed() *RepoSeed

func (*MemberSeed) Marshal

func (m *MemberSeed) Marshal() (dAtA []byte, err error)

func (*MemberSeed) MarshalTo

func (m *MemberSeed) MarshalTo(dAtA []byte) (int, error)

func (*MemberSeed) ProtoMessage

func (*MemberSeed) ProtoMessage()

func (*MemberSeed) Reset

func (m *MemberSeed) Reset()

func (*MemberSeed) Size

func (m *MemberSeed) Size() (n int)

func (*MemberSeed) String

func (m *MemberSeed) String() string

func (*MemberSeed) Unmarshal

func (m *MemberSeed) Unmarshal(dAtA []byte) error

func (*MemberSeed) XXX_DiscardUnknown

func (m *MemberSeed) XXX_DiscardUnknown()

func (*MemberSeed) XXX_Marshal

func (m *MemberSeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MemberSeed) XXX_Merge

func (m *MemberSeed) XXX_Merge(src proto.Message)

func (*MemberSeed) XXX_Size

func (m *MemberSeed) XXX_Size() int

func (*MemberSeed) XXX_Unmarshal

func (m *MemberSeed) XXX_Unmarshal(b []byte) error

type MemberSession

type MemberSession struct {
	ctx.Context

	CR *CommunityRepo

	// Pathname to member repo files (shared by all client instances)
	SharedPath string

	// Pathname to member repo files specific to a member client/workstation ID.
	WorkstationPath string

	// Uniquely identifies the client install instance
	WorkstationID []byte

	SessionToken []byte

	MemberEpoch pdi.MemberEpoch
	MemberIDStr string

	ChSessionsCount sync.WaitGroup

	ChSessionsMutex sync.RWMutex
	ChSessions      map[ChSessID]*ChSession
	// contains filtered or unexported fields
}

MemberSession represents a user/member "logged in", meaning a SKI session is active.

func NewMemberSession

func NewMemberSession(
	CR *CommunityRepo,
	inSessReq *MemberSessionReq,
	inMsgOutlet Repo_OpenMemberSessionServer,
) (*MemberSession, error)

NewMemberSession sets up a MemberSession for use.

TODO: close inSKI if an error is returned

func (*MemberSession) OpenMsgPipe

func (ms *MemberSession) OpenMsgPipe(inPipe Repo_OpenMsgPipeServer) error

OpenMsgPipe blocks until the client closes their pipe or this Member session is closing.

WARNING: a client can create multiple pipes, so ensure that all activity is threadsafe.

type MemberSessionReq

type MemberSessionReq struct {
	// Identifies a workstation/client installation (metaphorical to a "dumb" terminal in the 70's and 80's).
	// Two different members could have member sessions with the same workstation ID into a given repo (but not at the same time).
	WorkstationID []byte `protobuf:"bytes,1,opt,name=workstationID,proto3" json:"workstationID,omitempty"`
	// Which community this session wants to access
	CommunityID []byte `protobuf:"bytes,2,opt,name=communityID,proto3" json:"communityID,omitempty"`
	// The client member's info
	MemberEpoch *pdi.MemberEpoch `protobuf:"bytes,3,opt,name=member_epoch,json=memberEpoch,proto3" json:"member_epoch,omitempty"`
	// This will evolve in time, but in general, the client authenticates by submitting a token,
	//    which is a hash of biometric-based input (e.g. pin, password, key-fob, eye scan) plus
	//    a secure token from the previous session.
	// This is used to create a symmetric key to encrypt/decrypt the member's primary key hive
	//    that resides on the host.
	Passhash []byte `protobuf:"bytes,5,opt,name=passhash,proto3" json:"passhash,omitempty"`
	// When the above symmetric key is created, it's placed it and other session info into a "secret box",
	//    and is locked with a key only the host has has, and sent back as the "session token".
	// This allows the client to present the session_token (until it expires) instead of the client
	//    having to perform full biometric authentication.
	SessionToken         []byte   `protobuf:"bytes,6,opt,name=session_token,json=sessionToken,proto3" json:"session_token,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MemberSessionReq) Descriptor

func (*MemberSessionReq) Descriptor() ([]byte, []int)

func (*MemberSessionReq) GetCommunityID

func (m *MemberSessionReq) GetCommunityID() []byte

func (*MemberSessionReq) GetMemberEpoch

func (m *MemberSessionReq) GetMemberEpoch() *pdi.MemberEpoch

func (*MemberSessionReq) GetPasshash

func (m *MemberSessionReq) GetPasshash() []byte

func (*MemberSessionReq) GetSessionToken

func (m *MemberSessionReq) GetSessionToken() []byte

func (*MemberSessionReq) GetWorkstationID

func (m *MemberSessionReq) GetWorkstationID() []byte

func (*MemberSessionReq) Marshal

func (m *MemberSessionReq) Marshal() (dAtA []byte, err error)

func (*MemberSessionReq) MarshalTo

func (m *MemberSessionReq) MarshalTo(dAtA []byte) (int, error)

func (*MemberSessionReq) ProtoMessage

func (*MemberSessionReq) ProtoMessage()

func (*MemberSessionReq) Reset

func (m *MemberSessionReq) Reset()

func (*MemberSessionReq) Size

func (m *MemberSessionReq) Size() (n int)

func (*MemberSessionReq) String

func (m *MemberSessionReq) String() string

func (*MemberSessionReq) Unmarshal

func (m *MemberSessionReq) Unmarshal(dAtA []byte) error

func (*MemberSessionReq) XXX_DiscardUnknown

func (m *MemberSessionReq) XXX_DiscardUnknown()

func (*MemberSessionReq) XXX_Marshal

func (m *MemberSessionReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MemberSessionReq) XXX_Merge

func (m *MemberSessionReq) XXX_Merge(src proto.Message)

func (*MemberSessionReq) XXX_Size

func (m *MemberSessionReq) XXX_Size() int

func (*MemberSessionReq) XXX_Unmarshal

func (m *MemberSessionReq) XXX_Unmarshal(b []byte) error

type Msg

type Msg struct {
	// If originating from the client, this ID should be set to a unique, increasing ID.
	// All Msgs emitted in response to a previous Msg will cite its original ID, allowing the client to filter for a specific ID.
	ID uint32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
	// Describes the purpose of this op, what args it uses, and what it's intended to do.
	Op MsgOp `protobuf:"varint,2,opt,name=op,proto3,enum=repo.MsgOp" json:"op,omitempty"`
	// When a Msg originates, this value is used to route it to the correct internal channel session.
	// If 0, this msg is to/from the MemberSession itself for control messages, etc.
	ChSessID uint32 `protobuf:"varint,3,opt,name=ch_sessID,json=chSessID,proto3" json:"ch_sessID,omitempty"`
	// If the op involves a channel entry, then it will be set here.
	EntryInfo  *pdi.EntryInfo `protobuf:"bytes,10,opt,name=entry_info,json=entryInfo,proto3" json:"entry_info,omitempty"`
	EntryState *EntryState    `protobuf:"bytes,11,opt,name=entry_state,json=entryState,proto3" json:"entry_state,omitempty"`
	// If set, the op failed for the given reason
	Error string `protobuf:"bytes,12,opt,name=error,proto3" json:"error,omitempty"`
	// Params for the given MsgOp
	T0                   int64    `protobuf:"varint,20,opt,name=T0,proto3" json:"T0,omitempty"`
	FLAGS                uint32   `protobuf:"varint,21,opt,name=FLAGS,proto3" json:"FLAGS,omitempty"`
	BUF0                 []byte   `protobuf:"bytes,22,opt,name=BUF0,proto3" json:"BUF0,omitempty"`
	ITEMS                [][]byte `protobuf:"bytes,23,rep,name=ITEMS,proto3" json:"ITEMS,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Msg) Descriptor

func (*Msg) Descriptor() ([]byte, []int)

func (*Msg) GetBUF0

func (m *Msg) GetBUF0() []byte

func (*Msg) GetChSessID

func (m *Msg) GetChSessID() uint32

func (*Msg) GetEntryInfo

func (m *Msg) GetEntryInfo() *pdi.EntryInfo

func (*Msg) GetEntryState

func (m *Msg) GetEntryState() *EntryState

func (*Msg) GetError

func (m *Msg) GetError() string

func (*Msg) GetFLAGS

func (m *Msg) GetFLAGS() uint32

func (*Msg) GetID

func (m *Msg) GetID() uint32

func (*Msg) GetITEMS

func (m *Msg) GetITEMS() [][]byte

func (*Msg) GetOp

func (m *Msg) GetOp() MsgOp

func (*Msg) GetT0

func (m *Msg) GetT0() int64

func (*Msg) Marshal

func (m *Msg) Marshal() (dAtA []byte, err error)

func (*Msg) MarshalTo

func (m *Msg) MarshalTo(dAtA []byte) (int, error)

func (*Msg) ProtoMessage

func (*Msg) ProtoMessage()

func (*Msg) Reset

func (m *Msg) Reset()

func (*Msg) Size

func (m *Msg) Size() (n int)

func (*Msg) String

func (m *Msg) String() string

func (*Msg) Unmarshal

func (m *Msg) Unmarshal(dAtA []byte) error

func (*Msg) XXX_DiscardUnknown

func (m *Msg) XXX_DiscardUnknown()

func (*Msg) XXX_Marshal

func (m *Msg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Msg) XXX_Merge

func (m *Msg) XXX_Merge(src proto.Message)

func (*Msg) XXX_Size

func (m *Msg) XXX_Size() int

func (*Msg) XXX_Unmarshal

func (m *Msg) XXX_Unmarshal(b []byte) error

type MsgOp

type MsgOp int32
const (
	// This Msg functionally does nothing but serves as a heartbeat to indicate the channel session is open and operating normally.
	MsgOp_OK MsgOp = 0
	// Msg.BUF0 is a ski.KeyTomeCrypt protobuf that contains community keys that should be added to the member session on the repo side.
	MsgOp_ADD_COMMUNITY_KEYS MsgOp = 1
	// When the repo sees this op, it will retain the community keyring up to the given unix timestamp in T0.
	// If the community keyring should not be retained, set T0 to 0 (or any timestamp in the past),
	MsgOp_RETAIN_COMMUNITY_KEYS MsgOp = 2
	// Sent in response to a CH_NEW_ENTRY_READY (to the repo)
	// Msg.ITEMS is a list of raw txns of an entry ready to be committed.
	MsgOp_COMMIT_TXNS MsgOp = 3
	// Requests the latest pdi.ChInfo for the given or current channel ID.
	// If sessID == 0, BUF0 is a ChID
	// If sessID > 0, BUF0 is ignored (and the ChID of open channel is used)
	// Response: is a pdi.ChInfo
	MsgOp_LATEST_CH_INFO MsgOp = 4
	// Requests the latest pdi.ChannelEpoch for the given or current channel ID.
	// Response: is a pdi.ChannelEpoch
	MsgOp_LATEST_CH_EPOCH MsgOp = 5
	// BUF0 is a marshalled plan.ChInvocation
	MsgOp_START_CH_SESSION MsgOp = 6
	// Sent to the client following OpenMemberSession.
	MsgOp_MEMBER_SESSION_READY MsgOp = 7
	// Sent in response to a COMMIT_TXNS (to the client)
	// msg.EntryInfo and msg EntryState contain info associated with the given txn (may be nil)
	MsgOp_COMMIT_TXNS_COMPLETE MsgOp = 8
	// Sent to the member session when a new channel is to be created.
	// BODY is a ChannelEpoch
	MsgOp_CH_GENESIS_ENTRY MsgOp = 9
	// Closes the session associated with the session ID.  Any subsequent Msgs addressed to this session ID will be ignored/dropped.
	MsgOp_CLOSE_CH_SESSION MsgOp = 10
	// Sent by the client when the user wishes to author a new content entry in the channel associated with this sessID.
	// The msg's EntryInfo contains basic info about the entry to build from.
	MsgOp_POST_CH_ENTRY MsgOp = 11
	// The ChSession seek to T0 and start returning a stream of CH_ENTRY msgs, effectively "replaying" the channel.
	// The param FLAGS contains number of ChSessionFlags
	MsgOp_RESET_ENTRY_READER MsgOp = 12
	MsgOp_RESERVED_13        MsgOp = 13
	MsgOp_RESERVED_14        MsgOp = 14
	// Sent to the client when the channel is closed
	MsgOp_CH_SESSION_CLOSED MsgOp = 15
	// The msg's EntryInfo is set and reflects an entry in the channel and BUF0 is the body.
	MsgOp_CH_ENTRY MsgOp = 16
	// Sent when an entry changes liveness
	MsgOp_CH_ENTRY_UPDATE MsgOp = 17
	// Sent in response to a POST_CH_ENTRY or CH_GENESIS_ENTRY to the client.
	// The msg's EntryInfo is ready to be encoded and encrypted with the body.
	// From there, client is expected to:
	//   1) pack+sign the readied EntryInfo with the entry body
	//   2) encrypt this newly generated "payload buffer" with the community key associated with CommunityEpoch cited in the EntryInfo
	//   3) Marshal the encrypted payload and community epoch ID into the final EntryCrypt.
	//   4) Encode the EntryCrypt into StorageProvider txns
	//   5) Submit the resulting txn(s) to the repo via COMMIT_TXNS.
	MsgOp_CH_NEW_ENTRY_READY MsgOp = 18
	MsgOp_RESERVED_19        MsgOp = 19
	MsgOp_RESERVED_20        MsgOp = 20
	// Send by the Workstation to the client.
	// BUF0 is a phost,WsLogin protobuf.
	// The client echos this msg back to the workstation on success.
	MsgOp_LOGIN_TO_WS_SEAT MsgOp = 21
)

func (MsgOp) EnumDescriptor

func (MsgOp) EnumDescriptor() ([]byte, []int)

func (MsgOp) String

func (x MsgOp) String() string

type RepoClient

type RepoClient interface {
	// Bootstraps a repo for a given member.
	SeedRepo(ctx context.Context, in *RepoSeed, opts ...grpc.CallOption) (*plan.Status, error)
	// Starts a new client member session.
	// The session ID returned from the resulting MsgOp_OK should be used for sending message to member session.
	OpenMemberSession(ctx context.Context, in *MemberSessionReq, opts ...grpc.CallOption) (Repo_OpenMemberSessionClient, error)
	// Sends msgs to channel session or the root member session itself, via Msg.SessID.
	// A client typically only needs one open call to this because all outbound channel traffic plus messages to the
	// session that control the member session.
	OpenMsgPipe(ctx context.Context, opts ...grpc.CallOption) (Repo_OpenMsgPipeClient, error)
}

RepoClient is the client API for Repo service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewRepoClient

func NewRepoClient(cc *grpc.ClientConn) RepoClient

type RepoConfig

type RepoConfig struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RepoConfig) Descriptor

func (*RepoConfig) Descriptor() ([]byte, []int)

func (*RepoConfig) Marshal

func (m *RepoConfig) Marshal() (dAtA []byte, err error)

func (*RepoConfig) MarshalTo

func (m *RepoConfig) MarshalTo(dAtA []byte) (int, error)

func (*RepoConfig) ProtoMessage

func (*RepoConfig) ProtoMessage()

func (*RepoConfig) Reset

func (m *RepoConfig) Reset()

func (*RepoConfig) Size

func (m *RepoConfig) Size() (n int)

func (*RepoConfig) String

func (m *RepoConfig) String() string

func (*RepoConfig) Unmarshal

func (m *RepoConfig) Unmarshal(dAtA []byte) error

func (*RepoConfig) XXX_DiscardUnknown

func (m *RepoConfig) XXX_DiscardUnknown()

func (*RepoConfig) XXX_Marshal

func (m *RepoConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RepoConfig) XXX_Merge

func (m *RepoConfig) XXX_Merge(src proto.Message)

func (*RepoConfig) XXX_Size

func (m *RepoConfig) XXX_Size() int

func (*RepoConfig) XXX_Unmarshal

func (m *RepoConfig) XXX_Unmarshal(b []byte) error

type RepoSeed

type RepoSeed struct {
	SignedGenesisSeed    []byte              `protobuf:"bytes,1,opt,name=signed_genesis_seed,json=signedGenesisSeed,proto3" json:"signed_genesis_seed,omitempty"`
	SuggestedDirName     string              `protobuf:"bytes,2,opt,name=suggested_dir_name,json=suggestedDirName,proto3" json:"suggested_dir_name,omitempty"`
	CommunityName        string              `protobuf:"bytes,3,opt,name=community_name,json=communityName,proto3" json:"community_name,omitempty"`
	Services             []*plan.ServiceInfo `protobuf:"bytes,5,rep,name=services,proto3" json:"services,omitempty"`
	XXX_NoUnkeyedLiteral struct{}            `json:"-"`
	XXX_unrecognized     []byte              `json:"-"`
	XXX_sizecache        int32               `json:"-"`
}

func (*RepoSeed) Descriptor

func (*RepoSeed) Descriptor() ([]byte, []int)

func (*RepoSeed) ExtractAndVerifyGenesisSeed

func (repoSeed *RepoSeed) ExtractAndVerifyGenesisSeed() (*GenesisSeed, error)

ExtractAndVerifyGenesisSeed unpacks, unmarshals, and verifies the GenesisSeed contained within repoSeed.SignedGenesisSeed.

func (*RepoSeed) GetCommunityName

func (m *RepoSeed) GetCommunityName() string

func (*RepoSeed) GetServices

func (m *RepoSeed) GetServices() []*plan.ServiceInfo

func (*RepoSeed) GetSignedGenesisSeed

func (m *RepoSeed) GetSignedGenesisSeed() []byte

func (*RepoSeed) GetSuggestedDirName

func (m *RepoSeed) GetSuggestedDirName() string

func (*RepoSeed) Marshal

func (m *RepoSeed) Marshal() (dAtA []byte, err error)

func (*RepoSeed) MarshalTo

func (m *RepoSeed) MarshalTo(dAtA []byte) (int, error)

func (*RepoSeed) ProtoMessage

func (*RepoSeed) ProtoMessage()

func (*RepoSeed) Reset

func (m *RepoSeed) Reset()

func (*RepoSeed) Size

func (m *RepoSeed) Size() (n int)

func (*RepoSeed) String

func (m *RepoSeed) String() string

func (*RepoSeed) Unmarshal

func (m *RepoSeed) Unmarshal(dAtA []byte) error

func (*RepoSeed) XXX_DiscardUnknown

func (m *RepoSeed) XXX_DiscardUnknown()

func (*RepoSeed) XXX_Marshal

func (m *RepoSeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RepoSeed) XXX_Merge

func (m *RepoSeed) XXX_Merge(src proto.Message)

func (*RepoSeed) XXX_Size

func (m *RepoSeed) XXX_Size() int

func (*RepoSeed) XXX_Unmarshal

func (m *RepoSeed) XXX_Unmarshal(b []byte) error

type RepoServer

type RepoServer interface {
	// Bootstraps a repo for a given member.
	SeedRepo(context.Context, *RepoSeed) (*plan.Status, error)
	// Starts a new client member session.
	// The session ID returned from the resulting MsgOp_OK should be used for sending message to member session.
	OpenMemberSession(*MemberSessionReq, Repo_OpenMemberSessionServer) error
	// Sends msgs to channel session or the root member session itself, via Msg.SessID.
	// A client typically only needs one open call to this because all outbound channel traffic plus messages to the
	// session that control the member session.
	OpenMsgPipe(Repo_OpenMsgPipeServer) error
}

RepoServer is the server API for Repo service.

type Repo_OpenMemberSessionClient

type Repo_OpenMemberSessionClient interface {
	Recv() (*Msg, error)
	grpc.ClientStream
}

type Repo_OpenMemberSessionServer

type Repo_OpenMemberSessionServer interface {
	Send(*Msg) error
	grpc.ServerStream
}

type Repo_OpenMsgPipeClient

type Repo_OpenMsgPipeClient interface {
	Send(*Msg) error
	CloseAndRecv() (*plan.Status, error)
	grpc.ClientStream
}

type Repo_OpenMsgPipeServer

type Repo_OpenMsgPipeServer interface {
	SendAndClose(*plan.Status) error
	Recv() (*Msg, error)
	grpc.ServerStream
}

type UnimplementedRepoServer

type UnimplementedRepoServer struct {
}

UnimplementedRepoServer can be embedded to have forward compatible implementations.

func (*UnimplementedRepoServer) OpenMemberSession

func (*UnimplementedRepoServer) OpenMsgPipe

func (*UnimplementedRepoServer) SeedRepo

func (*UnimplementedRepoServer) SeedRepo(ctx context.Context, req *RepoSeed) (*plan.Status, error)

Jump to

Keyboard shortcuts

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