Documentation ¶
Index ¶
- Constants
- Variables
- func RandomBlobNamespaceID() []byte
- func RandomBlobNamespaceIDWithPRG(prg *tmrand.Rand) []byte
- func RandomVerzionZeroID() []byte
- type Namespace
- func From(b []byte) (Namespace, error)
- func MustNew(version uint8, id []byte) Namespace
- func MustNewV0(subID []byte) Namespace
- func New(version uint8, id []byte) (Namespace, error)
- func NewV0(subID []byte) (Namespace, error)
- func RandomBlobNamespace() Namespace
- func RandomBlobNamespaceWithPRG(prg *tmrand.Rand) Namespace
- func RandomBlobNamespaces(rand *tmrand.Rand, count int) (namespaces []Namespace)
- func RandomNamespace() Namespace
- func (n Namespace) Bytes() []byte
- func (n Namespace) Equals(n2 Namespace) bool
- func (n Namespace) IsGreaterOrEqualThan(n2 Namespace) bool
- func (n Namespace) IsGreaterThan(n2 Namespace) bool
- func (n Namespace) IsLessOrEqualThan(n2 Namespace) bool
- func (n Namespace) IsLessThan(n2 Namespace) bool
- func (n Namespace) IsParityShares() bool
- func (n Namespace) IsPayForBlob() bool
- func (n Namespace) IsPrimaryReserved() bool
- func (n Namespace) IsPrimaryReservedPadding() bool
- func (n Namespace) IsReserved() bool
- func (n Namespace) IsSecondaryReserved() bool
- func (n Namespace) IsTailPadding() bool
- func (n Namespace) IsTx() bool
- func (n Namespace) Repeat(times int) []Namespace
Constants ¶
const ( // NamespaveVersionSize is the size of a namespace version in bytes. NamespaceVersionSize = appconsts.NamespaceVersionSize // NamespaceIDSize is the size of a namespace ID in bytes. NamespaceIDSize = appconsts.NamespaceIDSize // NamespaceSize is the size of a namespace (version + ID) in bytes. NamespaceSize = appconsts.NamespaceSize // NamespaceVersionZero is the first namespace version. NamespaceVersionZero = uint8(0) // NamespaceVersionMax is the max namespace version. NamespaceVersionMax = math.MaxUint8 // NamespaceZeroPrefixSize is the number of `0` bytes that are prefixed to // namespace IDs for version 0. NamespaceVersionZeroPrefixSize = 18 // NamespaceVersionZeroIDSize is the number of bytes available for // user-specified namespace ID in a namespace ID for version 0. NamespaceVersionZeroIDSize = NamespaceIDSize - NamespaceVersionZeroPrefixSize )
Variables ¶
var ( // NamespaceVersionZeroPrefix is the prefix of a namespace ID for version 0. NamespaceVersionZeroPrefix = bytes.Repeat([]byte{0}, NamespaceVersionZeroPrefixSize) // TxNamespace is the namespace reserved for ordinary Cosmos SDK transactions. TxNamespace = primaryReservedNamespace(0x01) // IntermediateStateRootsNamespace is the namespace reserved for // intermediate state root data. IntermediateStateRootsNamespace = primaryReservedNamespace(0x02) // PayForBlobNamespace is the namespace reserved for PayForBlobs transactions. PayForBlobNamespace = primaryReservedNamespace(0x04) // PrimaryReservedPaddingNamespace is the namespace used for padding after all // primary reserved namespaces. PrimaryReservedPaddingNamespace = primaryReservedNamespace(0xFF) // MaxPrimaryReservedNamespace is the highest primary reserved namespace. // Namespaces lower than this are reserved for protocol use. MaxPrimaryReservedNamespace = primaryReservedNamespace(0xFF) // MinSecondaryReservedNamespace is the lowest secondary reserved namespace // reserved for protocol use. Namespaces higher than this are reserved for // protocol use. MinSecondaryReservedNamespace = secondaryReservedNamespace(0x00) // TailPaddingNamespace is the namespace reserved for tail padding. All data // with this namespace will be ignored. TailPaddingNamespace = secondaryReservedNamespace(0xFE) ParitySharesNamespace = secondaryReservedNamespace(0xFF) // SupportedBlobNamespaceVersions is a list of namespace versions that can be specified by a user for blobs. SupportedBlobNamespaceVersions = []uint8{NamespaceVersionZero} )
Functions ¶
func RandomBlobNamespaceID ¶
func RandomBlobNamespaceID() []byte
func RandomBlobNamespaceIDWithPRG ¶
RandomBlobNamespaceIDWithPRG returns a random blob namespace ID using the supplied Pseudo-Random number Generator (PRG).
func RandomVerzionZeroID ¶
func RandomVerzionZeroID() []byte
Types ¶
type Namespace ¶
func MustNew ¶
MustNew returns a new namespace with the provided version and id. It panics if the provided version or id are not supported.
func MustNewV0 ¶
MustNewV0 returns a new namespace with version 0 and the provided subID. This function panics if the provided subID would result in an invalid namespace.
func NewV0 ¶
NewV0 returns a new namespace with version 0 and the provided subID. subID must be <= 10 bytes. If subID is < 10 bytes, it will be left-padded with 0s to fill 10 bytes.
func RandomBlobNamespace ¶
func RandomBlobNamespace() Namespace
func RandomBlobNamespaceWithPRG ¶
RandomBlobNamespaceWithPRG generates and returns a random blob namespace using the supplied Pseudo-Random number Generator (PRG).
func RandomBlobNamespaces ¶
func RandomNamespace ¶
func RandomNamespace() Namespace
func (Namespace) IsGreaterOrEqualThan ¶
func (Namespace) IsGreaterThan ¶
func (Namespace) IsLessOrEqualThan ¶
func (Namespace) IsLessThan ¶
func (Namespace) IsParityShares ¶
func (Namespace) IsPayForBlob ¶
func (Namespace) IsPrimaryReserved ¶
func (Namespace) IsPrimaryReservedPadding ¶
func (Namespace) IsReserved ¶
IsReserved returns true if the namespace is reserved for protocol-use.