e9p_fs behaviour (e9p v0.1.0)

Summary

Types

fid()

-type fid() :: {QID :: e9p:qid(), State :: fid_state()}.

fid_state()

-type fid_state() :: term().

path()

-type path() :: [unicode:chardata()].

result()

-type result() :: {ok, state()} | {error, term(), state()}.

result(T)

-type result(T) :: {ok, T, state()} | {error, term(), state()}.

state()

-type state() :: term().

Callbacks

clunk/3

(optional)
-callback clunk(fid(), path(), state()) -> result().

create/6

-callback create(fid(), path(), Name :: unicode:chardata(), Perm :: e9p:u32(), Mode :: e9p:u8(), state()) ->
                    result({fid(), IOUnit :: e9p:u32()}).

flush/1

(optional)
-callback flush(state()) -> result().

init/1

-callback init(term()) -> {ok, state()} | {error, Reason :: term()}.

open/4

-callback open(fid(), path(), Mode :: integer(), state()) -> result({fid_state(), e9p:u32()}).

read/5

-callback read(fid(), path(), Offset :: non_neg_integer(), Length :: non_neg_integer(), state()) ->
                  result({fid_state(), iodata()}).

remove/3

-callback remove(fid(), path(), state()) -> result().

root/3

-callback root(UName :: unicode:chardata(), AName :: unicode:chardata(), state()) ->
                  {ok, fid_state(), state()}.

stat/3

-callback stat(fid(), path(), state()) -> result(map()).

walk/4

-callback walk(fid(), File :: unicode:chardata(), unicode:chardata(), state()) -> {fid() | false, state()}.

write/5

-callback write(fid(), path(), Offset :: non_neg_integer(), Data :: iodata(), state()) ->
                   result({fid_state(), non_neg_integer()}).

wstat/4

-callback wstat(fid(), path(), map(), state()) -> result().

Functions

clunk/2

create/5

init/1

open/3

read/4

remove/2

root/3

stat/2

walk/3

Walk through paths starting at QID.

write/4

wstat/3