Documentation ¶
Overview ¶
Several groups of exported symbols are available at different levels of abstraction:
- You might just want the multicodec registration! Then never deal with this package directly again.
- You might want to use the `Encode(Node,Writer)` and `Decode(NodeAssembler,Reader)` functions directly.
- You might want to use `ReusableEncoder` and `ReusableDecoder` types and their configuration options, then use their Encode and Decode methods with that additional control.
- You might want to use the lower-level TokenReader and TokenWriter tools to process the serial data as a stream, without necessary creating ipld Nodes at all.
- (this is a stretch) You might want to use some of the individual token processing functions, perhaps as part of a totally new codec that just happens to share some behaviors with this one.
The first three are exported from this package. The last two can be found in the "./token" subpackage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Unmarshal ¶
Unmarshal reads data from input, parses it as DAG-JSON, and unfolds the data into the given NodeAssembler.
The strict interpretation of DAG-JSON is used. Use a ReusableMarshaller and set its DecoderConfig if you need looser or otherwise customized decoding rules.
This function is the same as the function found for DAG-JSON in the default multicodec registry.
Types ¶
type ReusableUnmarshaller ¶
type ReusableUnmarshaller struct { InitialBudget int64 // contains filtered or unexported fields }
ReusableUnmarshaller has an Unmarshal method, and also supports customizable DecoderConfig and resource budgets.
The Unmarshal method may be used repeatedly (although not concurrently). Keeping a ReusableUnmarshaller around and using it repeatedly may allow the user to amortize some allocations (some internal buffers can be reused).
func (*ReusableUnmarshaller) SetDecoderConfig ¶
func (r *ReusableUnmarshaller) SetDecoderConfig(cfg jsontoken.DecoderConfig)
func (*ReusableUnmarshaller) SetInitialBudget ¶
func (r *ReusableUnmarshaller) SetInitialBudget(budget int64)