Blob


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