Blame


1 8a7ec697 2015-10-26 adrien package p9pnew
2 8a7ec697 2015-10-26 adrien
3 755621ad 2015-11-11 stephen.d import "golang.org/x/net/context"
4 8a7ec697 2015-10-26 adrien
5 8a7ec697 2015-10-26 adrien // Session provides the central abstraction for a 9p connection. Clients
6 8a7ec697 2015-10-26 adrien // implement sessions and servers serve sessions. Sessions can be proxied by
7 8a7ec697 2015-10-26 adrien // serving up a client session.
8 8a7ec697 2015-10-26 adrien //
9 8a7ec697 2015-10-26 adrien // The interface is also wired up with full context support to manage timeouts
10 8a7ec697 2015-10-26 adrien // and resource clean up.
11 8a7ec697 2015-10-26 adrien //
12 8a7ec697 2015-10-26 adrien // Session represents the operations covered in section 5 of the plan 9 manual
13 8a7ec697 2015-10-26 adrien // (http://man.cat-v.org/plan_9/5/). Requests are managed internally, so the
14 8a7ec697 2015-10-26 adrien // Flush method is handled by the internal implementation. Consider preceeding
15 8a7ec697 2015-10-26 adrien // these all with context to control request timeout.
16 8a7ec697 2015-10-26 adrien type Session interface {
17 8a7ec697 2015-10-26 adrien Auth(ctx context.Context, afid Fid, uname, aname string) (Qid, error)
18 8a7ec697 2015-10-26 adrien Attach(ctx context.Context, fid, afid Fid, uname, aname string) (Qid, error)
19 8a7ec697 2015-10-26 adrien Clunk(ctx context.Context, fid Fid) error
20 8a7ec697 2015-10-26 adrien Remove(ctx context.Context, fid Fid) error
21 8a7ec697 2015-10-26 adrien Walk(ctx context.Context, fid Fid, newfid Fid, names ...string) ([]Qid, error)
22 8a7ec697 2015-10-26 adrien Read(ctx context.Context, fid Fid, p []byte, offset int64) (n int, err error)
23 8a7ec697 2015-10-26 adrien Write(ctx context.Context, fid Fid, p []byte, offset int64) (n int, err error)
24 deb98ab4 2015-11-05 stephen.d Open(ctx context.Context, fid Fid, mode Flag) (Qid, uint32, error)
25 deb98ab4 2015-11-05 stephen.d Create(ctx context.Context, parent Fid, name string, perm uint32, mode Flag) (Qid, uint32, error)
26 b714e9e0 2015-11-05 stephen.d Stat(ctx context.Context, fid Fid) (Dir, error)
27 b714e9e0 2015-11-05 stephen.d WStat(ctx context.Context, fid Fid, dir Dir) error
28 8a7ec697 2015-10-26 adrien
29 fb37ce2a 2015-10-30 stephen.d // Version returns the supported version and msize of the session. This
30 fb37ce2a 2015-10-30 stephen.d // can be affected by negotiating or the level of support provided by the
31 fb37ce2a 2015-10-30 stephen.d // session implementation.
32 dce371f6 2015-11-05 stephen.d Version() (msize int, version string)
33 8a7ec697 2015-10-26 adrien }