plan

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// GenericErrorFamily errors generally relate to pnode
	GenericErrorFamily int32 = 5000 + iota

	// AssertFailed means an unreachable part of code was...reached.  :\
	AssertFailed

	// ParamErr means one or more params was missing, nil, or malformed.
	ParamErr

	// MarshalFailed means Marshal() returned an error
	MarshalFailed

	// UnmarshalFailed means Unmarshal() returned an error
	UnmarshalFailed

	// Unimplemented means flow hit a point requiring deeper implementation
	Unimplemented

	// FileSysError means an unexpected file sys error occured
	FileSysError

	// ConfigNotRead denotes that the given file was not found/read
	ConfigNotRead

	// ServiceShutdown means the host service is either shutting down is shutdown
	ServiceShutdown

	// RepoEntryErrorFamily errors generally relate to prepo
	RepoEntryErrorFamily = 5100 + iota

	// BadPDIEntryFormat means the PDI entry being processed is corrupted or was created using an unsupported format
	BadPDIEntryFormat

	// CommunityNotFound means the specified community name or ID did not match any of the registered communities
	CommunityNotFound

	// CommunityEpochNotFound means the community epoch ID cited was not found in this repo.
	CommunityEpochNotFound

	// CommunityKeyNotAvailable means no community key sessions knew of the given community key.
	CommunityKeyNotAvailable

	// FailedToConnectStorageProvider means the connection attempt the StorageProvider failed
	FailedToConnectStorageProvider

	// MemberEpochNotFound means the given member ID and/or member epoch num was not found
	MemberEpochNotFound

	// ChannelNotFound means the given ChannelID was not found in the community repo
	ChannelNotFound

	// ChannelSessionNotFound means the given channel session ID did not reference an active channel session.
	ChannelSessionNotFound

	// FailedToLoadChannel means a channel failed to load all its files from its host community repo
	FailedToLoadChannel

	// ChAgentNotFound means the requested channel agent was not found
	ChAgentNotFound

	// InvalidEntrySignature means the entry did not match the signature computed for the given entry body and the author's corresponding verify sig
	InvalidEntrySignature

	// AuthorNotFound means the given author was not found in the given access control list.
	AuthorNotFound

	// ACCNotFound means the access channel specified by a given PDI entry was not found
	ACCNotFound

	// NotAnACC means the channel ID cited by a PDI entry was not actually an access channel
	NotAnACC

	// FailedToProcessPDIHeader means decryption or unmarshalling of a PDI failed
	FailedToProcessPDIHeader

	// ViolatesCommunityEpoch means the given entry being processed is inconsistent or violates a constraint established in the governing community epoch.
	ViolatesCommunityEpoch

	// ChEntryIsMalformed means decryption or unmarshalling of a pdi channel entry failed
	ChEntryIsMalformed

	// ChEntryNotMerged means the given entry cannot yet be merged and must wait
	ChEntryNotMerged

	// ChEntryIsNotLive means the requested entry is not currently live
	ChEntryIsNotLive

	// AuthorLacksWritePermission means the given PDI entry's author does not have write permission to the specified channel
	AuthorLacksWritePermission

	// BadTimestamp means a timestamp is in the excessively distant past or future
	BadTimestamp

	// ChannelEpochNotFound means the cited epoch of the target channel did not match any known epochs locally.
	ChannelEpochNotFound

	// ChannelEpochNotLive means the cited channel epoch is not currently live
	ChannelEpochNotLive

	// ChannelEpochDisallows means the entry does not conform to its cited channel epoch
	ChannelEpochDisallows

	// ChannelEpochExpired means the cited channel epoch has been superseded and does not allow the given entry.
	ChannelEpochExpired

	// GenesisEntryNotVerified means an entry was marked as a genesis entry but could not be verified.
	GenesisEntryNotVerified

	// TxnDBNotReady means the txnDB failed to read or write txn data
	TxnDBNotReady

	// TxnNotConsistent means info in one or more txns is at odds, meaning malicious txn packaging may be in play
	TxnNotConsistent

	// StorageNotConsistent means the storae provider returned info that is suspect or inconsistent
	StorageNotConsistent

	// TxnDecodeFailed means the given txn failed to be decoded
	TxnDecodeFailed

	// UnsupportedPayloadCodec means the given txn payload codec type is not recognized or supported
	UnsupportedPayloadCodec

	// CannotExtractTxnPayload means the txn payload failed to be extracted
	CannotExtractTxnPayload

	// SecurityErrorFamily errors relate to PLAN's Secure Key Interface (SKI)
	SecurityErrorFamily = 5200 + iota

	// KeyringNotFound means the given key set was not found
	KeyringNotFound

	// KeyEntryNotFound means a key source did not contain the requested pub key (or pub key fragment)
	KeyEntryNotFound

	// InvocationNotAvailable means an SKI session was started with an unrecognized invocation string
	InvocationNotAvailable

	// InvocationAlreadyExists means an ski.Provider has already been registered with the given invocation string
	InvocationAlreadyExists

	// CryptoKitIDAlreadyRegistered  means the given package ID was already registered
	CryptoKitIDAlreadyRegistered

	// CryptoKitNotFound means the requested CryptoKitID was not registered for any CryptoKitID
	CryptoKitNotFound

	// HashKitNotFound means the requested HashKitID was not found
	HashKitNotFound

	// KeyGenerationFailed means key generation failed
	KeyGenerationFailed

	// KeyringNotSpecified means no keyring scope name was given for the SKI operation
	KeyringNotSpecified

	// CommunityNotSpecified means inArgs.KeySpecs.CommunityID was not set (and so the op can't proceed)
	CommunityNotSpecified

	// UnknownSKIOpName means the given SKI op name was not recognized
	UnknownSKIOpName

	// InsufficientSKIAccess means the requested permissions were not issued to allow the operation to proceed
	InsufficientSKIAccess

	// InvalidSKISession means the given session is not currently open
	InvalidSKISession

	// KeyIDCollision occurs when a key is placed in a keyring that already contains the key ID
	KeyIDCollision

	// KeyImportFailed means one or more keys that tried to be imported failed.
	KeyImportFailed

	// BadKeyFormat means key data was a length or format that was invalid or unexpected
	BadKeyFormat

	// FailedToDecryptKeyImport means a PDI entry body content failed to decrypt
	FailedToDecryptKeyImport

	// FailedToProcessKeyImport means that an error occurred while processing a PDI key import
	FailedToProcessKeyImport

	// FailedToMarshalKeyExport means an error occurred while encoding a PDI key export
	FailedToMarshalKeyExport

	// FailedToDecryptData means either the key or buffer to to be decrypted failed verification,
	FailedToDecryptData

	// VerifySignatureFailed means either the given signature did not match the given digest.
	VerifySignatureFailed

	// KeyTomeFailedToLoad means the cold storage for a keyring failed to load or does not exist
	KeyTomeFailedToLoad

	// KeyTomeFailedToWrite means an error occured while trying to write a key file
	KeyTomeFailedToWrite

	// StorageErrorFamily errors relate to PLAN's PDI Storage abstraction
	StorageErrorFamily = 5300 + iota

	// InvalidStorageSession means the given storage session ID was not found
	InvalidStorageSession

	// InvalidDatabaseID means the database ID provided is suspiciously short or long
	InvalidDatabaseID

	// FailedToAccessPath means a pathname was unable to be created or otherwise accessed
	FailedToAccessPath

	// FailedToLoadDatabase means an error was encountered when creating or loading the database
	FailedToLoadDatabase

	// FailedToCommitTxns means an unexpected fatal error occurred while committing one ore more txns
	FailedToCommitTxns

	// IncompatibleStorage means the given TxnEncoder desc string reflects that the SP and client are incompatible
	IncompatibleStorage

	// EncoderSessionNotReady means that TxnEncoder.ResetSession() has either not yet been called or the SKI session associated with it has closed.
	EncoderSessionNotReady

	// StorageImplNotFound means the requested storage impl is not available, etc.
	StorageImplNotFound

	// TxnPartsMissing means one or more required txn parts are not present
	TxnPartsMissing

	// AccountNotAvailable means the StorageProvider failed to find the account associated w/ the txn's "from" public key (or is damaged)
	AccountNotAvailable

	// InsufficientPostage means the sender does not have a balance to commit their txn
	InsufficientPostage

	// TransferFailed means the gas/fiat transfer failed (e.g. insufficient funds)
	TransferFailed

	// StorageNotReady means a problem occurred at the storage level
	StorageNotReady

	// NetworkNotReady means the network is in an unusable state
	NetworkNotReady

	// ConfigFailure means something went wrong loading/reading config
	ConfigFailure

	// TxnQueryFailed means the txn query failed to execute
	TxnQueryFailed

	// TxnFailedToDecode means TxnDecoder.DecodeRawTxn() returned an error
	TxnFailedToDecode

	// NetworkErrorFamily errors generally relate to network services and connections
	NetworkErrorFamily = 5400 + iota
)
View Source
const (

	// CommunityIDSz is the number of bytes used to to identify a PLAN community ID.
	// Background on probability of hash collision: http://preshing.com/20110504/hash-collision-probabilities/
	// Should this be smaller or larger?  Philosophically, this value expresses the size of the hash universe,
	//    where nodes can "safely" generate hashnames alongside peers.  2^192 outta be enough for anybody.
	CommunityIDSz = 24

	// SymmetricPubKeySz is the number of bytes used to identify a symmetric key entry on a PLAN keyring.
	// It's "modest-sized" since a newly generated keys must pass collision checks before being put into use.
	SymmetricPubKeySz = 16

	// WorkstationIDSz is the number of bytes used to to identify a PLAN workstation ID.
	WorkstationIDSz = 16

	// ChIDSz specifies the byte size of a PLAN channel ID (and is the right-most bytes of a TID.
	ChIDSz = 18

	// TIDSz is the number of bytes for a TID ("time ID")
	// Having 20 hash bytes is as strong as Ethereum and Bitcoin's address system.
	//
	// Byte layout is designed so that TIDs are sortable by an embedded timestamp:
	//    0:6   - Standard UTC timestamp in unix seconds (BE)
	//    6:8   - Timestamp fraction (BE)
	//    8:27  - Signature/hash bytes
	TIDSz = 27

	// MemberIDSz is the byte size of a MemberID
	MemberIDSz = 4

	// MemberAliasMaxLen is the max UTF8 string length a community member can use for their member alias
	MemberAliasMaxLen = 127
)
View Source
const (
	DefaultStorageProviderServicePort = "5190" // hosts the grpc service StorageProvider, used for serving Repo clients.
	DefaultRepoServicePort            = "5191" // hosts the grpc service Repo, used for serving PLAN clients.
	DefaultWorkstationServicePort     = "5192" // hosts the gprc service WsService, used for serving PLAN workstations.
)

Default ports used in PLAN

View Source
const (

	// TimeFSMax is the largest possible TimeFS value
	TimeFSMax = TimeFS(DistantFuture)

	// DistantFuture is a const used to express the "distant future" in unix time.
	DistantFuture int64 = (1 << 63) - 1

	// DistantPast is a const used to express the "distant past" in unix time.
	DistantPast int64 = -DistantFuture
)
View Source
const CodecCodeForBlock = 0x0201

CodecCodeForBlock signals that the associated buffer was created from plan.Block.Marshal()

View Source
const CodecCodeForEntryCrypt = 0x0202

CodecCodeForEntryCrypt signals that the associated buffer was created from pdi.EntryCrypt.Marshal()

Variables

View Source
var (
	// BinEncoding is used to encode/decode binary bufs in PLAN.
	BinEncoding = base64.RawURLEncoding

	// GenesisMemberID is the genesis member ID
	GenesisMemberID = uint32(1)
)
View Source
var (
	ErrInvalidLengthPlan = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPlan   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	// DefaultFileMode is used to express the default mode of file creation.
	DefaultFileMode = os.FileMode(0775)
)
View Source
var NilTID = TIDBlob{
	0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0,
}

NilTID is a reserved TID that denotes a void/nil/zero value of a TID

View Source
var ServiceType_name = map[int32]string{
	0: "Undefined",
	1: "StorageProvider",
	2: "Repo",
	3: "WsHost",
	4: "ServiceTracker",
}
View Source
var ServiceType_value = map[string]int32{
	"Undefined":       0,
	"StorageProvider": 1,
	"Repo":            2,
	"WsHost":          3,
	"ServiceTracker":  4,
}
View Source
var ValType_name = map[int32]string{
	0: "NONE",
	1: "INT",
	2: "FLOAT",
	3: "STR",
	4: "BLOCK",
}
View Source
var ValType_value = map[string]int32{
	"NONE":  0,
	"INT":   1,
	"FLOAT": 2,
	"STR":   3,
	"BLOCK": 4,
}

Functions

func Assert

func Assert(inCond bool, inMsg string)

Assert asserts essential assumptions

func Assertf

func Assertf(inCond bool, inFormat string, inArgs ...interface{})

Assertf asserts essential assumptions

func BinEncode

func BinEncode(in []byte) string

BinEncode encodes the given binary buffer into PLAN's std encoding (BinEncoding)

func CreateNewDir

func CreateNewDir(inBasePath, inPath string) (string, error)

CreateNewDir creates the specified dir (and returns an error if the dir already exists)

If inPath is absolute then inBasePath is ignored. Returns the effective pathname.

func IsError

func IsError(inErr error, inErrCodes ...int32) bool

IsError tests if the given error is a PLAN error code (below)

func MakeFSFriendly

func MakeFSFriendly(inName string, inSuffix []byte) string

MakeFSFriendly makes a given string safe to use for a file system. If inSuffix is given, the hex encoding of those bytes are appended after a space.

func Now

func Now() int64

Now returns the current time as a standard unix UTC timestamp.

func SetupBaseDir

func SetupBaseDir(
	inLocalPath string,
	inCreate bool,
) (string, error)

SetupBaseDir parses/expands inLocalPath and then verifies it's existence or non-existence, depending on inCreate and returning the the expanded path.

If inCreate == true, an error is returned if the dir exists or failed to be created.

If inCreate == false, an error is returned if the die doesn't exist.

Types

type Block

type Block struct {
	// An optional, name/label for this Block (i.e. a field-name).
	// A Block's label conforms to the context/protocol it's being used with (as applicable).
	Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	// Similar to a MIME type, this descriptor self-describes the data format of Block.content.
	// Anyone handed this Block uses this field to accurately process/deserialize its content.
	// This is a "multicodec path" -- see: https://github.com/multiformats/multistream
	Codec string `protobuf:"bytes,2,opt,name=codec,proto3" json:"codec,omitempty"`
	// This is a reserved integer alternative to Block.Codec.
	// See: https://github.com/plan-systems/multicodec/blob/master/table.csv
	CodecCode uint32 `protobuf:"varint,3,opt,name=codec_code,json=codecCode,proto3" json:"codec_code,omitempty"`
	// Payload data, serialized in accordance with the accompanying codec descriptors (above).
	Content    []byte `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
	ContentStr string `protobuf:"bytes,5,opt,name=content_str,json=contentStr,proto3" json:"content_str,omitempty"`
	// A Block can optionally contain nested "sub" blocks.  A Block's sub-blocks
	//    can be interpreted or employed any way a client or protocol sees fit.
	Subs                 []*Block `protobuf:"bytes,10,rep,name=subs,proto3" json:"subs,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Block is a portable, compact, self-describing, nestable information container inspired from HTTP.

func (*Block) AddBlock

func (block *Block) AddBlock(inBlock *Block)

AddBlock appends the given block to this block's list of sub blocks

func (*Block) AddContentWithCodec

func (block *Block) AddContentWithCodec(inContent []byte, inCodec string)

AddContentWithCodec appends a new block with the given content buf an accompanying multicodec path

func (*Block) AddContentWithLabel

func (block *Block) AddContentWithLabel(inContent []byte, inLabel string)

AddContentWithLabel appends a new block with the given label and content

func (*Block) Descriptor

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

func (*Block) GetBlockWithCodec

func (block *Block) GetBlockWithCodec(inCodec string, inCodecCode uint32) *Block

GetBlockWithCodec returns the first-appearing Block with a matching codec string (self and shallow search only)

func (*Block) GetBlockWithLabel

func (block *Block) GetBlockWithLabel(inLabel string) *Block

GetBlockWithLabel returns the first-appearing Block with a matching block label -- see GetBlocksWithLabel()

func (*Block) GetBlocksWithCodec

func (block *Block) GetBlocksWithCodec(inCodec string, inCodecCode uint32) []*Block

GetBlocksWithCodec returns all Blocks with a matching codec string (SearchBlocksSelf + SearchBlocksShallow)

func (*Block) GetBlocksWithLabel

func (block *Block) GetBlocksWithLabel(inLabel string) []*Block

GetBlocksWithLabel returns all Blocks with a matching block label (SearchBlocksSelf + SearchBlocksShallow)

func (*Block) GetCodec

func (m *Block) GetCodec() string

func (*Block) GetCodecCode

func (m *Block) GetCodecCode() uint32

func (*Block) GetContent

func (m *Block) GetContent() []byte

func (*Block) GetContentStr

func (m *Block) GetContentStr() string

func (*Block) GetContentWithCodec

func (block *Block) GetContentWithCodec(inCodec string, inCodecCode uint32) []byte

GetContentWithCodec returns the content of the first-appearing Block with a matching label/name

func (*Block) GetContentWithLabel

func (block *Block) GetContentWithLabel(inLabel string) []byte

GetContentWithLabel returns the content of the first-appearing Block with a matching label/name

func (*Block) GetLabel

func (m *Block) GetLabel() string

func (*Block) GetSubs

func (m *Block) GetSubs() []*Block

func (*Block) InvokeBlocksWithCodec

func (block *Block) InvokeBlocksWithCodec(
	inCodec string,
	inCodecCode uint32,
	inCallback func(inMatch *Block) error,
) error

InvokeBlocksWithCodec performs a self and shallow search for matching Blocks. If an error is encountered, iteration stops and the error is returned.

func (*Block) Marshal

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

func (*Block) MarshalTo

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

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) Reset

func (m *Block) Reset()

func (*Block) Size

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

func (*Block) String

func (m *Block) String() string

func (*Block) Unmarshal

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

func (*Block) XXX_DiscardUnknown

func (m *Block) XXX_DiscardUnknown()

func (*Block) XXX_Marshal

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

func (*Block) XXX_Merge

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

func (*Block) XXX_Size

func (m *Block) XXX_Size() int

func (*Block) XXX_Unmarshal

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

type BlockSearchScope

type BlockSearchScope int

BlockSearchScope specifies what parts of a Block to search for matches. The GetBlock*() calls below that don't accept a BlockSearchScope parameter implicitly use:

SearchBlocksSelf + SearchBlocksShallow
const (

	// SearchBlocksSelf means the root block is analyzed as a possible match.
	SearchBlocksSelf BlockSearchScope = 1 + iota

	// SearchBlocksShallow searches the "subs" part of the given target but no more
	SearchBlocksShallow

	// SearchBlocksDepthFirst searches into each sub-Block recursively.
	SearchBlocksDepthFirst
)

type ChID

type ChID []byte

ChID identifies a PLAN channel.

func (ChID) Blob

func (chID ChID) Blob() ChIDBlob

Blob is a convenience function that forms a ChID byte array from a ChID byte slice.

func (ChID) Clone

func (chID ChID) Clone() ChID

Clone returns a duplicate of this ChID

func (ChID) Str

func (chID ChID) Str() string

Str returns this channel ID in plan.BinEncoding form.

func (ChID) SuffixStr

func (chID ChID) SuffixStr() string

SuffixStr returns the last few digits of this ChID in string form (for easy reading, logs, etc)

type ChIDBlob

type ChIDBlob [ChIDSz]byte

ChIDBlob is a fixed-length buffer that contains a ChID

type ChInvocation

type ChInvocation struct {
	ChID                 []byte   `protobuf:"bytes,1,opt,name=chID,proto3" json:"chID,omitempty"`
	ChProtocol           string   `protobuf:"bytes,2,opt,name=ch_protocol,json=chProtocol,proto3" json:"ch_protocol,omitempty"`
	ChAdapterID          string   `protobuf:"bytes,3,opt,name=ch_adapterID,json=chAdapterID,proto3" json:"ch_adapterID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChInvocation) Descriptor

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

func (*ChInvocation) GetChAdapterID

func (m *ChInvocation) GetChAdapterID() string

func (*ChInvocation) GetChID

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

func (*ChInvocation) GetChProtocol

func (m *ChInvocation) GetChProtocol() string

func (*ChInvocation) Marshal

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

func (*ChInvocation) MarshalTo

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

func (*ChInvocation) ProtoMessage

func (*ChInvocation) ProtoMessage()

func (*ChInvocation) Reset

func (m *ChInvocation) Reset()

func (*ChInvocation) Size

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

func (*ChInvocation) String

func (m *ChInvocation) String() string

func (*ChInvocation) Unmarshal

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

func (*ChInvocation) XXX_DiscardUnknown

func (m *ChInvocation) XXX_DiscardUnknown()

func (*ChInvocation) XXX_Marshal

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

func (*ChInvocation) XXX_Merge

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

func (*ChInvocation) XXX_Size

func (m *ChInvocation) XXX_Size() int

func (*ChInvocation) XXX_Unmarshal

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

type CommunityID

type CommunityID [CommunityIDSz]byte

CommunityID identifies a PLAN community and is randomly generated during its genesis.

func GetCommunityID

func GetCommunityID(in []byte) CommunityID

GetCommunityID returns the CommunityID for the given buffer

type Err

type Err struct {
	Status

	Err error
}

Err is PLAN's common error struct. Err.Code allows easy matching while allowing error strings to contain useful contextual information.

func Error

func Error(inErr error, inCode int32, inMsg string) *Err

Error create a new PError

func Errorf

func Errorf(inErr error, inCode int32, inFormat string, inArgs ...interface{}) *Err

Errorf is a convenience function of Error() that uses a string formatter.

func (*Err) Error

func (e *Err) Error() string

Error implements error's Error()

type Link struct {
	// THis is an optional label that describes this link or serves as an identifying key (and is follows a naming convention so this link can be identified by label)
	// This value is typically not seen by humans.
	Label string `protobuf:"bytes,1,opt,name=label,proto3" json:"label,omitempty"`
	// This describes this link in a meaningful way
	Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"`
	// See docs on PLAN URIs (above)
	URI                  string   `protobuf:"bytes,3,opt,name=URI,proto3" json:"URI,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Link is an opaque URI most comparable to a URL, but it's "multiaddr" style, rather than protocol://URI.

func (*Link) Descriptor

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

func (*Link) GetDesc

func (m *Link) GetDesc() string

func (*Link) GetLabel

func (m *Link) GetLabel() string

func (*Link) GetURI

func (m *Link) GetURI() string

func (*Link) Marshal

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

func (*Link) MarshalTo

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

func (*Link) ProtoMessage

func (*Link) ProtoMessage()

func (*Link) Reset

func (m *Link) Reset()

func (*Link) Size

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

func (*Link) String

func (m *Link) String() string

func (*Link) Unmarshal

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

func (*Link) XXX_DiscardUnknown

func (m *Link) XXX_DiscardUnknown()

func (*Link) XXX_Marshal

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

func (*Link) XXX_Merge

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

func (*Link) XXX_Size

func (m *Link) XXX_Size() int

func (*Link) XXX_Unmarshal

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

type MemberAlias

type MemberAlias string

MemberAlias is a self-given community member name and is how they are seen by humans in the community,

making it a convenience tool for humans to easily refer to other members.

A member can change their MemberAlias at any time (though there may be reasonable restrictions in place). Note: a MemberID is generated from the right-most bytes of the SHA256 hash of the community ID concatenated

with the member's first chosen alias (or an alternatively entered "member ID generation phrase").  This
scheme makes the member ID recoverable from human memory, even if there is no network access.

type MemberID

type MemberID uint32

MemberID identifies a member within a given community and never changes -- even when a member initiates

a new "epoch" so their crypto can be regenerated.

Member IDs are considered collision-proof since inside a community, they must be cleared through

the community's new member registration process (which will reject a collision).

type Multicodec

type Multicodec uint32

Multicodec is a compact way of specifying a binary format -- see https://github.com/plan-systems/multicodec

const (
	UnspecifiedCodec Multicodec = 0
	TxnSegmentCodec  Multicodec = 0x3050
	TxnInfoCodec     Multicodec = 0x3051
	SigHeaderCodec   Multicodec = 0x3052
	EntryCryptCodec  Multicodec = 0x3053
	EntryInfoCodec   Multicodec = 0x3054
	BlockCodec       Multicodec = 0x3055
	LinkCodec        Multicodec = 0x3056
	URICodec         Multicodec = 0x3057
)

Multicodec standard values used in PLAN. See https://github.com/plan-systems/multicodec/blob/master/table.csv

type ServiceInfo

type ServiceInfo struct {
	ServiceType          ServiceType `protobuf:"varint,1,opt,name=service_type,json=serviceType,proto3,enum=plan.ServiceType" json:"service_type,omitempty"`
	NameID               string      `protobuf:"bytes,2,opt,name=nameID,proto3" json:"nameID,omitempty"`
	NodeID               []byte      `protobuf:"bytes,3,opt,name=nodeID,proto3" json:"nodeID,omitempty"`
	Desc                 string      `protobuf:"bytes,4,opt,name=desc,proto3" json:"desc,omitempty"`
	Addr                 string      `protobuf:"bytes,10,opt,name=addr,proto3" json:"addr,omitempty"`
	Network              string      `protobuf:"bytes,11,opt,name=network,proto3" json:"network,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

ServiceInfo contains descriptions, network addresses, ports, and connection info for remote services.

func (*ServiceInfo) Descriptor

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

func (*ServiceInfo) GetAddr

func (m *ServiceInfo) GetAddr() string

func (*ServiceInfo) GetDesc

func (m *ServiceInfo) GetDesc() string

func (*ServiceInfo) GetNameID

func (m *ServiceInfo) GetNameID() string

func (*ServiceInfo) GetNetwork

func (m *ServiceInfo) GetNetwork() string

func (*ServiceInfo) GetNodeID

func (m *ServiceInfo) GetNodeID() []byte

func (*ServiceInfo) GetServiceType

func (m *ServiceInfo) GetServiceType() ServiceType

func (*ServiceInfo) Marshal

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

func (*ServiceInfo) MarshalTo

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

func (*ServiceInfo) ProtoMessage

func (*ServiceInfo) ProtoMessage()

func (*ServiceInfo) Reset

func (m *ServiceInfo) Reset()

func (*ServiceInfo) Size

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

func (*ServiceInfo) String

func (m *ServiceInfo) String() string

func (*ServiceInfo) Unmarshal

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

func (*ServiceInfo) XXX_DiscardUnknown

func (m *ServiceInfo) XXX_DiscardUnknown()

func (*ServiceInfo) XXX_Marshal

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

func (*ServiceInfo) XXX_Merge

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

func (*ServiceInfo) XXX_Size

func (m *ServiceInfo) XXX_Size() int

func (*ServiceInfo) XXX_Unmarshal

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

type ServiceType

type ServiceType int32
const (
	ServiceType_Undefined       ServiceType = 0
	ServiceType_StorageProvider ServiceType = 1
	ServiceType_Repo            ServiceType = 2
	ServiceType_WsHost          ServiceType = 3
	ServiceType_ServiceTracker  ServiceType = 4
)

func (ServiceType) EnumDescriptor

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

func (ServiceType) String

func (x ServiceType) String() string

type Status

type Status struct {
	// Information code
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// Information msg
	Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// An unordered list of arbitrary fields/params associated with this error
	Params               []*Val   `protobuf:"bytes,3,rep,name=params,proto3" json:"params,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Status) Descriptor

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

func (*Status) GetCode

func (m *Status) GetCode() int32

func (*Status) GetMsg

func (m *Status) GetMsg() string

func (*Status) GetParams

func (m *Status) GetParams() []*Val

func (*Status) Marshal

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

func (*Status) MarshalTo

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

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) Reset

func (m *Status) Reset()

func (*Status) Size

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

func (*Status) String

func (m *Status) String() string

func (*Status) Unmarshal

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

func (*Status) XXX_DiscardUnknown

func (m *Status) XXX_DiscardUnknown()

func (*Status) XXX_Marshal

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

func (*Status) XXX_Merge

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

func (*Status) XXX_Size

func (m *Status) XXX_Size() int

func (*Status) XXX_Unmarshal

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

type StorageID

type StorageID uint16

StorageID identifies a storage instance within a given community.

When a storage network/provider is created to host a given community, it is identified from other (previous) instances by ensuring that the newly assigned StorageID is unique in community's history, something trivially done by the person(s) leading the storage switchover. In the lifetime of a community, there would only need to be a new StorageID generated when the community moved to a new storage provider/network.

type TID

type TID []byte

TID identifies a specific PLAN channel, channel entry, or anything else labeled via plan.GenerateIID()

func (TID) Blob

func (tid TID) Blob() TIDBlob

Blob is a convenience function that forms a TID byte array from a TID byte slice.

func (TID) Clone

func (tid TID) Clone() TID

Clone returns a duplicate of this TID

func (TID) CopyNext

func (tid TID) CopyNext(inTID TID)

CopyNext copies the given TID and increments it by 1, typically useful for seeking the next entry after a given one.

func (TID) ExtractChID

func (tid TID) ExtractChID() ChID

ExtractChID returns the ChID for what is presumed to be a channel genesis entry (whose ChID is dervied from the EntryID)

func (TID) ExtractTime

func (tid TID) ExtractTime() int64

ExtractTime returns the unix timestamp embedded in this TID (a unix timestamp in seconds UTC)

func (TID) ExtractTimeFS

func (tid TID) ExtractTimeFS() TimeFS

ExtractTimeFS returns the unix timestamp embedded in this TID (a unix timestamp in 1<<16 seconds UTC)

func (TID) IsNil

func (tid TID) IsNil() bool

IsNil returns true if this TID length is 0 or is equal to NilTID

func (TID) PrefixStr

func (tid TID) PrefixStr() string

PrefixStr returns the left-hand part of this TID as plan.Base64 (typically used to visually inspect the timestamp of this TID)

func (TID) SelectEarlier

func (tid TID) SelectEarlier(inTime TimeFS) bool

SelectEarlier looks in inTime a chooses whichever is earlier.

If inTime is later than the time embedded in this TID, then this function has no effect and returns false.

If inTime is earlier, then this TID is initialized to inTime (and the rest zeroed out) and returns true.

func (TID) SetHash

func (tid TID) SetHash(inHash []byte)

SetHash set the sig/hash portion of this ID

func (TID) SetTimeAndHash

func (tid TID) SetTimeAndHash(inTime TimeFS, inHash []byte)

SetTimeAndHash writes the given timestamp and the right-most part of inSig into this TID.

See comments for plan.TIDSz

func (TID) SetTimeFS

func (tid TID) SetTimeFS(inTime TimeFS)

SetTimeFS writes the given timestamp into this TIS

func (TID) Str

func (tid TID) Str() string

Str returns this TID in plan.Base64 form.

func (TID) SuffixStr

func (tid TID) SuffixStr() string

SuffixStr returns the last few digits of this TID in string form (for easy reading, logs, etc)

type TIDBlob

type TIDBlob [TIDSz]byte

TIDBlob is a fixed-length buffer that contains a TID

func (*TIDBlob) TID

func (tid *TIDBlob) TID() TID

TID is a convenience function that returns the TID contained within this TIDBlob.

type TimeFS

type TimeFS int64

TimeFS is the UTC in 1/1<<16 seconds elapsed since Jan 1, 1970 UTC ("FS" = fractional seconds)

Shifting this right 16 bits will yield stanard Unix time. This means there are 47 bits dedicated for seconds, implying max timestamp of 4.4 million years.

Note: if a precision deeper than one seconds is not available or n/a, then the best available precision should be used (or 0).

func NowFS

func NowFS() TimeFS

NowFS returns the current time (a standard unix UTC timestamp in 1/1<<16 seconds)

type Val

type Val struct {
	// The value's name/label/key
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Specifies which of the below are set/valid
	ValType              ValType  `protobuf:"varint,2,opt,name=val_type,json=valType,proto3,enum=plan.ValType" json:"val_type,omitempty"`
	Int                  int64    `protobuf:"varint,3,opt,name=int,proto3" json:"int,omitempty"`
	Float                float64  `protobuf:"fixed64,4,opt,name=float,proto3" json:"float,omitempty"`
	Str                  string   `protobuf:"bytes,5,opt,name=str,proto3" json:"str,omitempty"`
	Block                *Block   `protobuf:"bytes,6,opt,name=block,proto3" json:"block,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Val) Descriptor

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

func (*Val) GetBlock

func (m *Val) GetBlock() *Block

func (*Val) GetFloat

func (m *Val) GetFloat() float64

func (*Val) GetInt

func (m *Val) GetInt() int64

func (*Val) GetName

func (m *Val) GetName() string

func (*Val) GetStr

func (m *Val) GetStr() string

func (*Val) GetValType

func (m *Val) GetValType() ValType

func (*Val) Marshal

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

func (*Val) MarshalTo

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

func (*Val) ProtoMessage

func (*Val) ProtoMessage()

func (*Val) Reset

func (m *Val) Reset()

func (*Val) Size

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

func (*Val) String

func (m *Val) String() string

func (*Val) Unmarshal

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

func (*Val) XXX_DiscardUnknown

func (m *Val) XXX_DiscardUnknown()

func (*Val) XXX_Marshal

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

func (*Val) XXX_Merge

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

func (*Val) XXX_Size

func (m *Val) XXX_Size() int

func (*Val) XXX_Unmarshal

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

type ValType

type ValType int32
const (
	ValType_NONE  ValType = 0
	ValType_INT   ValType = 1
	ValType_FLOAT ValType = 2
	ValType_STR   ValType = 3
	ValType_BLOCK ValType = 4
)

func (ValType) EnumDescriptor

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

func (ValType) String

func (x ValType) String() string

Jump to

Keyboard shortcuts

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