reg

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: Unlicense Imports: 7 Imported by: 0

Documentation

Overview

Package reg is a registry for message types that implement the coding.Codec interface.

It is essentially a factory for messages, each registered message type has a function that returns a codec.Codec interface type containing the concrete type specified by the magic bytes.

It can either be used to manually generate a type as in the factory model, or is used as a recogniser, accepting a splice.Splice and returning the concrete type indicated by the magic prefix of the splice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCodec

func MakeCodec(magic string) (cdc coding.Codec)

func Recognise

func Recognise(s *splice.Splice) (cdc coding.Codec)

func Register

func Register(magicString string, cdc func() coding.Codec)

Types

type CodecGenerators

type CodecGenerators map[string]func() coding.Codec

Jump to

Keyboard shortcuts

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