Module machi_util

Miscellaneous utility functions.

Description

Miscellaneous utility functions.

Function Index

bin_to_hexstr/1Convert a binary() to a hexadecimal string.
bool2int/1
checksum_chunk/1Calculate a checksum for a chunk of file data.
combinations/1
connect/2Create a TCP connection to a remote Machi server.
connect/3Create a TCP connection to a remote Machi server.
hexstr_to_bin/1Convert a hexadecimal string to a binary().
hexstr_to_int/1Convert a hexadecimal string to an integer.
increment_max_filenum/2Increase the file size of a config file, which is used as the basis for a minimum sequence number.
info_msg/2Log an 'info' level message.
int2bool/1
int_to_hexbin/2Convert an integer into a hexadecimal string (in binary() form) whose length is based on I_size.
int_to_hexstr/2Convert an integer into a hexadecimal string whose length is based on I_size.
is_valid_filename/1Given a filename, return true if it is a valid machi filename, false otherwise.
make_binary/1Convert a compatible Erlang data type into a binary() equivalent.
make_checksum_filename/2Calculate a checksum file path, by common convention.
make_checksum_filename/4Calculate a checksum file path, by common convention.
make_config_filename/2Calculate a config file path, by common convention.
make_data_filename/2Calculate a file data file path, by common convention.
make_data_filename/4Calculate a file data file path, by common convention.
make_projection_filename/2Calculate a projection store file path, by common convention.
make_regname/1Create a registered name atom for FLU sequencer internal rendezvous/message passing use.
make_string/1Convert a compatible Erlang data type into a string() equivalent.
make_tagged_csum/1Create a tagged checksum.
make_tagged_csum/2Makes tagged csum.
mbytes/1
mk_order/2
ordered_combinations/1
parse_filename/1Given a machi filename, return a set of components in a list.
perms/1
permutations/1
pretty_time/0
pretty_time/2
read_max_filenum/2Read the file size of a config file, which is used as the basis for a minimum sequence number.
unmake_tagged_csum/1
verb/1Log a verbose message.
verb/2Log a verbose message.
wait_for_death/2
wait_for_life/2

Function Details

bin_to_hexstr/1

bin_to_hexstr(X1::binary()) -> string()

Convert a binary() to a hexadecimal string.

bool2int/1

bool2int(X1) -> any()

checksum_chunk/1

checksum_chunk(Chunk::binary() | iolist()) -> binary()

Calculate a checksum for a chunk of file data.

combinations/1

combinations(L) -> any()

connect/2

connect(Host::inet:ip_address() | inet:hostname(), Port::inet:port_number()) -> port()

Create a TCP connection to a remote Machi server.

connect/3

connect(Host::inet:ip_address() | inet:hostname(), Port::inet:port_number(), Timeout::timeout()) -> port()

Create a TCP connection to a remote Machi server.

hexstr_to_bin/1

hexstr_to_bin(S::string() | binary()) -> binary()

Convert a hexadecimal string to a binary().

hexstr_to_int/1

hexstr_to_int(X::string() | binary()) -> non_neg_integer()

Convert a hexadecimal string to an integer.

increment_max_filenum/2

increment_max_filenum(DataDir::string(), Prefix::string()) -> ok | {error, term()}

Increase the file size of a config file, which is used as the basis for a minimum sequence number.

info_msg/2

info_msg(Fmt::string(), Args::list()) -> term()

Log an 'info' level message.

int2bool/1

int2bool(I) -> any()

int_to_hexbin/2

int_to_hexbin(I::non_neg_integer(), I_size::non_neg_integer()) -> binary()

Convert an integer into a hexadecimal string (in binary() form) whose length is based on I_size.

int_to_hexstr/2

int_to_hexstr(I::non_neg_integer(), I_size::non_neg_integer()) -> string()

Convert an integer into a hexadecimal string whose length is based on I_size.

is_valid_filename/1

is_valid_filename(Filename::string()) -> true | false

Given a filename, return true if it is a valid machi filename, false otherwise.

make_binary/1

make_binary(X::binary() | iolist()) -> binary()

Convert a compatible Erlang data type into a binary() equivalent.

make_checksum_filename/2

make_checksum_filename(DataDir::string(), FileName::[] | string() | binary()) -> string()

Calculate a checksum file path, by common convention.

make_checksum_filename/4

make_checksum_filename(DataDir::string(), Prefix::string(), SequencerName::atom() | string() | binary(), FileNum::integer()) -> string()

Calculate a checksum file path, by common convention.

make_config_filename/2

make_config_filename(DataDir::string(), Prefix::string()) -> string()

Calculate a config file path, by common convention.

make_data_filename/2

make_data_filename(DataDir::string(), File::[] | string() | binary()) -> {binary(), string()}

Calculate a file data file path, by common convention.

make_data_filename/4

make_data_filename(DataDir::string(), Prefix::string(), SequencerName::atom() | string() | binary(), FileNum::integer() | string()) -> {binary(), string()}

Calculate a file data file path, by common convention.

make_projection_filename/2

make_projection_filename(DataDir::string(), File::[] | string()) -> string()

Calculate a projection store file path, by common convention.

make_regname/1

make_regname(Prefix::binary() | string()) -> atom()

Create a registered name atom for FLU sequencer internal rendezvous/message passing use.

make_string/1

make_string(X::binary() | iolist()) -> string()

Convert a compatible Erlang data type into a string() equivalent.

make_tagged_csum/1

make_tagged_csum(X1) -> any()

Create a tagged checksum

make_tagged_csum/2

make_tagged_csum(X1::machi_dt:csum_tag(), SHA::binary()) -> machi_dt:chunk_csum()

Makes tagged csum. Each meanings are: none / ?CSUM_TAG_NONE - a suspicious and nonsense checksum client_sha / ?CSUM_TAG_CLIENT_SHA - a valid checksum given by client and stored in server server_sha / ?CSUM_TAG_SERVER_SHA - a valid checksum generated by and stored in server server_regen_sha / ?CSUM_TAG_SERVER_REGEN_SHA - a valid checksum generated by server in an ad hoc manner, not stored in server

mbytes/1

mbytes(Size) -> any()

mk_order/2

mk_order(UPI2, Repair1) -> any()

ordered_combinations/1

ordered_combinations(Master) -> any()

parse_filename/1

parse_filename(Filename::string()) -> [string()]

Given a machi filename, return a set of components in a list. The components will be:

Invalid filenames will return an empty list.

perms/1

perms(L) -> any()

permutations/1

permutations(L) -> any()

pretty_time/0

pretty_time() -> any()

pretty_time/2

pretty_time(X1, MSec) -> any()

read_max_filenum/2

read_max_filenum(DataDir::string(), Prefix::string()) -> non_neg_integer()

Read the file size of a config file, which is used as the basis for a minimum sequence number.

unmake_tagged_csum/1

unmake_tagged_csum(X1) -> any()

verb/1

verb(Fmt::string()) -> ok

Log a verbose message.

verb/2

verb(Fmt::string(), Args::list()) -> ok

Log a verbose message.

wait_for_death/2

wait_for_death(Pid, Iters) -> any()

wait_for_life/2

wait_for_life(Reg, Iters) -> any()


Generated by EDoc, Dec 8 2015, 21:37:38.