Documentation ¶
Index ¶
- Constants
- func AsBytes(h Holder) []byte
- func BinarySize(h Holder) int
- func BinarySizeLocal(h LocalHolder) int
- func CheckParity(ref Holder, b []byte) error
- func Compare(ref0, ref1 Holder) int
- func Encode(h Holder) string
- func EncodeLocal(h LocalHolder) string
- func Equal(ref0, ref1 Holder) bool
- func GetParity(ref Holder) []byte
- func IsEmpty(ref Holder) bool
- func IsGlobalScope(ref Holder) bool
- func IsLifelineScope(ref Holder) bool
- func IsLocalDomainScope(ref Holder) bool
- func IsObjectReference(ref Holder) bool
- func IsRecordScope(ref Holder) bool
- func IsReservedName(domainName string) bool
- func IsSelfScope(ref Holder) bool
- func IsValidDomainName(domainName string) bool
- func IsValidObjectName(objectName string) bool
- func Marshal(h Holder) ([]byte, error)
- func MarshalJSON(h Holder) ([]byte, error)
- func MarshalLocal(h LocalHolder) ([]byte, error)
- func MarshalLocalJSON(v LocalHolder) (b []byte, err error)
- func MarshalLocalTo(h LocalHolder, data []byte) (int, error)
- func MarshalLocalToSizedBuffer(h LocalHolder, data []byte) (int, error)
- func MarshalTo(h Holder, b []byte) (int, error)
- func MarshalToSizedBuffer(h Holder, b []byte) (int, error)
- func PulseNumberOf(ref LocalHolder) pulse.Number
- func WriteWholeLocalTo(v Local, b []byte) int
- type ByteDecodeFunc
- type ByteDecoderFactory
- type ByteEncodeFunc
- type DecoderOptions
- type Encoder
- type EncoderOptions
- type Global
- func Copy(h Holder) Global
- func GlobalFromBytes(data []byte) (v Global)
- func GlobalFromString(input string) (Global, error)
- func GlobalObjectFromString(input string) (Global, error)
- func New(domainID, localID Local) Global
- func NewRecordOf(owner Global, localID Local) Global
- func NewRecordRef(recID Local) Global
- func NewSelf(localID Local) Global
- func NormCopy(h Holder) Global
- func UnmarshalGlobal(b []byte) (v Global, err error)
- func UnmarshalJSON(b []byte) (v Global, err error)
- func (v Global) AsByteString() longbits.ByteString
- func (v Global) AsBytes() []byte
- func (v Global) AsRecordID() Local
- func (v Global) Compare(other Holder) int
- func (v Global) Equal(other Holder) bool
- func (v Global) GetBase() Local
- func (v Global) GetLocal() Local
- func (v Global) GetScope() Scope
- func (v Global) IsEmpty() bool
- func (v Global) IsGlobalScope() bool
- func (v Global) IsLifelineScope() bool
- func (v Global) IsLocalDomainScope() bool
- func (v Global) IsObjectReference() bool
- func (v Global) IsRecordScope() bool
- func (v Global) IsSelfScope() bool
- func (v Global) IsZero() bool
- func (v *Global) MarshalBinary() ([]byte, error)
- func (v Global) String() string
- func (v *Global) UnmarshalBinary(data []byte) (err error)
- func (v Global) WriteTo(w io.Writer) (int64, error)
- type GlobalDecoder
- type Holder
- type IdentityDecoder
- type IdentityEncoder
- type Local
- func AsRecordID(v Holder) Local
- func CopyLocal(h LocalHolder) Local
- func EmptyLocal() *Local
- func LocalFromString(input string) (Local, error)
- func NewLocal(pn pulse.Number, scope SubScope, hash LocalHash) Local
- func NewRecordID(pn pulse.Number, hash LocalHash) Local
- func ReadWholeLocalFrom(b []byte) (v Local)
- func Unmarshal(b []byte) (base, local Local, err error)
- func UnmarshalLocal(data []byte) (v Local, err error)
- func UnmarshalLocalJSON(data []byte) (v Local, err error)
- func (v Local) AsByteString() longbits.ByteString
- func (v Local) AsBytes() []byte
- func (v Local) Compare(other Local) int
- func (v Local) DebugString() string
- func (v Local) Encode(enc Encoder) string
- func (v Local) Equal(o LocalHolder) bool
- func (v Local) GetHeader() LocalHeader
- func (v Local) GetLocal() Local
- func (v Local) GetPulseNumber() pulse.Number
- func (v Local) IdentityHash() LocalHash
- func (v Local) IdentityHashBytes() []byte
- func (v Local) IsEmpty() bool
- func (v Local) IsZero() bool
- func (v Local) NotEmpty() bool
- func (v Local) ProtoSize() int
- func (v Local) Pulse() pulse.Number
- func (v Local) String() string
- func (v Local) SubScope() SubScope
- func (v Local) WithHash(hash LocalHash) Local
- func (v Local) WithHeader(h LocalHeader) Local
- func (v Local) WithPulse(pn pulse.Number) Local
- func (v Local) WithSubScope(scope SubScope) Local
- func (v Local) WriteTo(w io.Writer) (int64, error)
- type LocalHash
- type LocalHeader
- type LocalHolder
- type MutableTemplate
- func (p *MutableTemplate) AsTemplate() Template
- func (p *MutableTemplate) CanAsRecord() bool
- func (p *MutableTemplate) GetBase() Local
- func (p *MutableTemplate) GetLocal() Local
- func (p *MutableTemplate) GetScope() Scope
- func (p *MutableTemplate) HasBase() bool
- func (p *MutableTemplate) HasHash() bool
- func (p *MutableTemplate) IsEmpty() bool
- func (p *MutableTemplate) IsZero() bool
- func (p *MutableTemplate) MustGlobal() Global
- func (p *MutableTemplate) MustRecord() Local
- func (p *MutableTemplate) SetHash(h LocalHash)
- func (p *MutableTemplate) SetZeroValue()
- func (p *MutableTemplate) WithHash(h LocalHash) Global
- func (p *MutableTemplate) WithHashAsRecord(h LocalHash) Local
- type PtrHolder
- type Scope
- type SelfScope
- type SubScope
- type Template
- func NewRecordRefTemplate(pn pulse.Number) Template
- func NewRefTemplate(template Holder, pn pulse.Number) Template
- func NewRefTemplateExt(base Local, local LocalHeader) Template
- func NewSelfRefTemplate(pn pulse.Number, scope SelfScope) Template
- func NewSelfRefTemplateExt(pn pulse.Number, scope Scope) Template
- func (v Template) AsMutable() MutableTemplate
- func (v Template) CanAsRecord() bool
- func (v Template) GetScope() Scope
- func (v Template) HasBase() bool
- func (v Template) IsZero() bool
- func (v Template) LocalHeader() LocalHeader
- func (v Template) WithHash(h LocalHash) Global
- func (v Template) WithHashAsRecord(h LocalHash) Local
- func (v Template) WithHashAsSelf(h LocalHash) Global
Constants ¶
View Source
const ( Parity EncoderOptions = 1 << iota EncodingSchema FormatSchema NilRef = "<nil>" // non-parsable SchemaV1 = "insolar" RecordRefIDSeparator = '.' )
View Source
const ( LocalBinaryHashSize = 28 LocalBinaryPulseAndScopeSize = 4 LocalBinarySize = LocalBinaryPulseAndScopeSize + LocalBinaryHashSize GlobalBinarySize = 2 * LocalBinarySize )
View Source
const LegacyDomainName = "11111111111111111111111111111111"
View Source
const RecordDomainName = "record"
View Source
const SubScopeMask = 1<<scopeBits - 1
View Source
const SuperScopeMask = SubScopeMask << scopeBits
Variables ¶
This section is empty.
Functions ¶
func BinarySize ¶
func BinarySizeLocal ¶
func BinarySizeLocal(h LocalHolder) int
func CheckParity ¶
func EncodeLocal ¶
func EncodeLocal(h LocalHolder) string
func IsGlobalScope ¶
func IsLifelineScope ¶
func IsLocalDomainScope ¶
func IsObjectReference ¶
func IsRecordScope ¶
func IsReservedName ¶
func IsSelfScope ¶
func IsValidDomainName ¶
func IsValidObjectName ¶
func MarshalJSON ¶
func MarshalLocal ¶
func MarshalLocal(h LocalHolder) ([]byte, error)
func MarshalLocalJSON ¶
func MarshalLocalJSON(v LocalHolder) (b []byte, err error)
func MarshalLocalTo ¶
func MarshalLocalTo(h LocalHolder, data []byte) (int, error)
func MarshalLocalToSizedBuffer ¶
func MarshalLocalToSizedBuffer(h LocalHolder, data []byte) (int, error)
func PulseNumberOf ¶
func PulseNumberOf(ref LocalHolder) pulse.Number
func WriteWholeLocalTo ¶
Types ¶
type ByteDecodeFunc ¶
type ByteDecodeFunc func(s string, target io.ByteWriter) (stringRead int, err error)
type ByteDecoderFactory ¶
type ByteDecoderFactory interface { GetByteDecoder(encodingName string) ByteDecodeFunc DefaultDecoder() ByteDecodeFunc LegacyDecoder() ByteDecodeFunc }
func NewByteDecoderFactory ¶
func NewByteDecoderFactory() ByteDecoderFactory
type ByteEncodeFunc ¶
type ByteEncodeFunc func(source io.ByteReader, builder *strings.Builder) error
type DecoderOptions ¶
type DecoderOptions uint8
const ( AllowLegacy DecoderOptions = 1 << iota AllowRecords IgnoreParity DoNotVerify )
type Encoder ¶
type Encoder interface { Encode(ref Holder) (string, error) EncodeToBuilder(ref Holder, b *strings.Builder) error EncodeRecord(rec LocalHolder) (string, error) }
func Base58Encoder ¶
func Base58Encoder() Encoder
func DefaultEncoder ¶
func DefaultEncoder() Encoder
func NewBase58Encoder ¶
func NewBase58Encoder(opts EncoderOptions) Encoder
func NewBase64Encoder ¶
func NewBase64Encoder(opts EncoderOptions) Encoder
type EncoderOptions ¶
type EncoderOptions uint8
type Global ¶
type Global struct {
// contains filtered or unexported fields
}
func GlobalFromBytes ¶
func GlobalFromString ¶
func GlobalObjectFromString ¶
func NewRecordOf ¶
func NewRecordRef ¶
For LIMITED USE ONLY - can only be used by observer/analytical code
func UnmarshalGlobal ¶
func UnmarshalJSON ¶
func (Global) AsByteString ¶
func (v Global) AsByteString() longbits.ByteString
func (Global) AsRecordID ¶
func (Global) IsGlobalScope ¶
func (Global) IsLifelineScope ¶
func (Global) IsLocalDomainScope ¶
func (Global) IsObjectReference ¶
func (Global) IsRecordScope ¶
func (Global) IsSelfScope ¶
func (*Global) MarshalBinary ¶
deprecated: use reference.Marshal, seems to be used by CBOR
func (*Global) UnmarshalBinary ¶
deprecated: use reference.Unmarshal, seems to be used by CBOR
type GlobalDecoder ¶
type GlobalDecoder interface { Decode(ref string) (Global, error) DecodeHolder(ref string) (Holder, error) }
func DefaultDecoder ¶
func DefaultDecoder() GlobalDecoder
func NewDecoder ¶
func NewDecoder(options DecoderOptions, factory ByteDecoderFactory) GlobalDecoder
func NewDefaultDecoder ¶
func NewDefaultDecoder(options DecoderOptions) GlobalDecoder
type Holder ¶
type Holder interface { LocalHolder GetScope() Scope // GetBase returns base portion of a full reference GetBase() Local }
type IdentityDecoder ¶
type IdentityEncoder ¶
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
func AsRecordID ¶
func CopyLocal ¶
func CopyLocal(h LocalHolder) Local
func EmptyLocal ¶
func EmptyLocal() *Local
func LocalFromString ¶
func ReadWholeLocalFrom ¶
func UnmarshalLocal ¶
func UnmarshalLocalJSON ¶
func (Local) AsByteString ¶
func (v Local) AsByteString() longbits.ByteString
func (Local) DebugString ¶
DebugString prints ID in human readable form.
func (Local) Equal ¶
func (v Local) Equal(o LocalHolder) bool
func (Local) GetHeader ¶
func (v Local) GetHeader() LocalHeader
func (Local) GetPulseNumber ¶
func (Local) IdentityHash ¶
func (Local) IdentityHashBytes ¶
func (Local) WithHeader ¶
func (v Local) WithHeader(h LocalHeader) Local
func (Local) WithSubScope ¶
type LocalHash ¶
func BytesToLocalHash ¶
func CopyToLocalHash ¶
func CopyToLocalHash(r longbits.FixedReader) (result LocalHash)
type LocalHeader ¶
type LocalHeader uint32
func NewLocalHeader ¶
func NewLocalHeader(pn pulse.Number, scope SubScope) LocalHeader
func (LocalHeader) Pulse ¶
func (v LocalHeader) Pulse() pulse.Number
func (LocalHeader) String ¶
func (v LocalHeader) String() string
func (LocalHeader) SubScope ¶
func (v LocalHeader) SubScope() SubScope
func (LocalHeader) WithHash ¶
func (v LocalHeader) WithHash(h LocalHash) Local
func (LocalHeader) WithPulse ¶
func (v LocalHeader) WithPulse(pn pulse.Number) LocalHeader
func (LocalHeader) WithSubScope ¶
func (v LocalHeader) WithSubScope(scope SubScope) LocalHeader
type LocalHolder ¶
type MutableTemplate ¶
type MutableTemplate struct {
// contains filtered or unexported fields
}
func (*MutableTemplate) AsTemplate ¶
func (p *MutableTemplate) AsTemplate() Template
func (*MutableTemplate) CanAsRecord ¶
func (p *MutableTemplate) CanAsRecord() bool
func (*MutableTemplate) GetBase ¶
func (p *MutableTemplate) GetBase() Local
func (*MutableTemplate) GetLocal ¶
func (p *MutableTemplate) GetLocal() Local
func (*MutableTemplate) GetScope ¶
func (p *MutableTemplate) GetScope() Scope
func (*MutableTemplate) HasBase ¶
func (p *MutableTemplate) HasBase() bool
func (*MutableTemplate) HasHash ¶
func (p *MutableTemplate) HasHash() bool
func (*MutableTemplate) IsEmpty ¶
func (p *MutableTemplate) IsEmpty() bool
func (*MutableTemplate) IsZero ¶
func (p *MutableTemplate) IsZero() bool
func (*MutableTemplate) MustGlobal ¶
func (p *MutableTemplate) MustGlobal() Global
func (*MutableTemplate) MustRecord ¶
func (p *MutableTemplate) MustRecord() Local
func (*MutableTemplate) SetHash ¶
func (p *MutableTemplate) SetHash(h LocalHash)
SetHash enables MustGlobal() and MustLocal(). Can be called multiple times to change hash.
func (*MutableTemplate) SetZeroValue ¶
func (p *MutableTemplate) SetZeroValue()
func (*MutableTemplate) WithHash ¶
func (p *MutableTemplate) WithHash(h LocalHash) Global
WithHash panics on zero template
func (*MutableTemplate) WithHashAsRecord ¶
func (p *MutableTemplate) WithHashAsRecord(h LocalHash) Local
WithHashAsLocal is valid for record ref or self ref template. Panics otherwise.
type PtrHolder ¶
type PtrHolder interface { Holder // GetBase returns base portion of a full reference GetLocalPtr() *Local GetBasePtr() *Local }
func NewPtrHolder ¶
func NewPtrRecord ¶
func NewPtrSelf ¶
type Scope ¶
type Scope uint8
const ( GlobalDomainPublicPolicy Scope GlobalDomainMember )
func (Scope) IsOfLifeline ¶
func (Scope) IsOfLocalDomain ¶
func (Scope) SuperScope ¶
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func NewRecordRefTemplate ¶
func NewRefTemplateExt ¶
func NewRefTemplateExt(base Local, local LocalHeader) Template
func (Template) AsMutable ¶
func (v Template) AsMutable() MutableTemplate
func (Template) CanAsRecord ¶
func (Template) LocalHeader ¶
func (v Template) LocalHeader() LocalHeader
func (Template) WithHashAsRecord ¶
WithHashAsLocal is valid for record ref or self ref template. Panics otherwise.
func (Template) WithHashAsSelf ¶
WithHashAsSelf panics on zero or record ref template
Click to show internal directories.
Click to hide internal directories.