Module avro_ocf

Encode/decode avro object container files.

Description

Encode/decode avro object container files

Data Types

array_type()

array_type() = #avro_array_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}

avro_type()

avro_type() = primitive_type() | array_type() | enum_type() | fixed_type() | map_type() | record_type() | union_type()

decoder_hook_fun()

decoder_hook_fun() = fun((avro_type(), name() | integer(), avro:in(), fun((avro:in()) -> avro:out())) -> avro:out())

decoder_options()

decoder_options() = #{encoding := avro_binary | avro_json, map_type := proplist | map, record_type := proplist | map, is_wrapped := boolean(), hook := decoder_hook_fun()}

enum_type()

enum_type() = #avro_enum_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], doc = avro:typedoc(), symbols = [avro:enum_symbol()], fullname = avro:fullname(), custom = [avro:custom_prop()]}

filename()

filename() = file:filename_all()

fixed_type()

fixed_type() = #avro_fixed_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], size = pos_integer(), fullname = avro:fullname(), custom = [avro:custom_prop()]}

fullname()

fullname() = binary()

header()

abstract datatype: header()

lkup()

lkup() = schema_store() | lkup_fun()

lkup_fun()

lkup_fun() = fun((fullname()) -> avro_type())

map_type()

map_type() = #avro_map_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}

meta()

meta() = [{string() | binary(), binary()}]

name()

name() = binary()

name_raw()

name_raw() = atom() | string() | binary()

primitive_type()

primitive_type() = #avro_primitive_type{name = avro:name(), custom = [avro:custom_prop()]}

record_type()

record_type() = #avro_record_type{name = avro:name(), namespace = avro:namespace(), doc = avro:typedoc(), aliases = [avro:name()], fields = [avro:record_field()], fullname = avro:fullname(), custom = [avro:custom_prop()]}

schema_store()

schema_store() = avro_schema_store:store()

type_or_name()

type_or_name() = avro_type() | name_raw()

union_type()

union_type() = #avro_union_type{id2type = avro_union:id2type(), name2id = avro_union:name2id()}

Function Index

append_file/3Append encoded objects to the file as one data block.
append_file/5Encode the given objects and append to the file as one data block.
decode_binary/1decode_binary/2 equivalent with default decoder options.
decode_binary/2Decode ocf binary into unwrapped values.
decode_file/1decode_file/2 equivalent with default decoder options.
decode_file/2Decode ocf into unwrapped values.
make_header/1Make ocf header.
make_header/2Make ocf header, and append the given metadata fields.
make_ocf/2
write_file/4Write objects in a single block to the given file name.
write_file/5Write objects in a single block to the given file name with custom metadata.
write_header/2Writer header bytes to a ocf file.

Function Details

append_file/3

append_file(Fd::file:io_device(), Header::header(), Objects::[binary()]) -> ok

Append encoded objects to the file as one data block.

append_file/5

append_file(Fd::file:io_device(), Header::header(), Lkup::lkup(), Schema::type_or_name(), Objects::[avro:in()]) -> ok

Encode the given objects and append to the file as one data block.

decode_binary/1

decode_binary(Bin::binary()) -> {header(), avro_type(), [avro:out()]}

decode_binary/2 equivalent with default decoder options.

decode_binary/2

decode_binary(Bin::binary(), Options::decoder_options()) -> {header(), avro_type(), [avro:out()]}

Decode ocf binary into unwrapped values.

decode_file/1

decode_file(Filename::filename()) -> {header(), avro_type(), [avro:out()]}

decode_file/2 equivalent with default decoder options.

decode_file/2

decode_file(Filename::filename(), Options::decoder_options()) -> {header(), avro_type(), [avro:out()]}

Decode ocf into unwrapped values.

make_header/1

make_header(Type::avro_type()) -> header()

Make ocf header.

make_header/2

make_header(Type::avro_type(), Meta0::meta()) -> header()

Make ocf header, and append the given metadata fields. You can use >>"avro.codec"<< metadata field to choose what data block coding should be used. Supported values are >>"null"<< (default) and >>"deflate"<< (compressed). Other values in avro namespace are reserved for internal use and can't be set. Other than that you are free to provide any custom metadata.

make_ocf/2

make_ocf(Header::header(), Objects::[binary()]) -> iodata()

write_file/4

write_file(Filename::filename(), Lkup::lkup(), Schema::type_or_name(), Objects::[avro:in()]) -> ok

Write objects in a single block to the given file name.

write_file/5

write_file(Filename::filename(), Lkup::lkup(), Schema::type_or_name(), Objects::[avro:in()], Meta::meta()) -> ok

Write objects in a single block to the given file name with custom metadata. @see make_header/2 for details about use of meta data.

write_header/2

write_header(Fd::file:io_device(), Header::header()) -> ok

Writer header bytes to a ocf file.


Generated by EDoc