add a bunch of methods to the client end
This commit is contained in:
parent
a5d237df2a
commit
5ab2cbd265
8 changed files with 236 additions and 17 deletions
|
|
@ -39,17 +39,22 @@ func (fs *WsFs) String() string {
|
|||
return "kubelwagen"
|
||||
}
|
||||
|
||||
func (fs *WsFs) getResponse(r *Request) (Response, bool) {
|
||||
c := getChannel()
|
||||
fs.req <- RequestCallback{
|
||||
message: *r,
|
||||
response: c,
|
||||
}
|
||||
resp, ok := <-c
|
||||
return resp, ok
|
||||
}
|
||||
|
||||
func (fs *WsFs) OpenDir(name string, context *fuse.Context) ([]fuse.DirEntry, fuse.Status) {
|
||||
r := Request{
|
||||
Method: MethodOpenDir,
|
||||
Path: name,
|
||||
}
|
||||
c := getChannel()
|
||||
fs.req <- RequestCallback{
|
||||
message: r,
|
||||
response: c,
|
||||
}
|
||||
resp, ok := <-c
|
||||
resp, ok := fs.getResponse(&r)
|
||||
if !ok {
|
||||
logrus.Errorln("Response to request channel closed")
|
||||
return fs.FileSystem.OpenDir(name, context)
|
||||
|
|
@ -62,16 +67,24 @@ func (fs *WsFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.St
|
|||
Method: MethodGetAttr,
|
||||
Path: name,
|
||||
}
|
||||
c := getChannel()
|
||||
fs.req <- RequestCallback{
|
||||
message: r,
|
||||
response: c,
|
||||
}
|
||||
resp, ok := <-c
|
||||
resp, ok := fs.getResponse(&r)
|
||||
if !ok {
|
||||
logrus.Errorln("Response to request channel closed")
|
||||
return fs.FileSystem.GetAttr(name, context)
|
||||
}
|
||||
return resp.Stat, resp.Code
|
||||
}
|
||||
|
||||
func (fs *WsFs) StatFs(name string) *fuse.StatfsOut {
|
||||
r := Request{
|
||||
Method: MethodStatFs,
|
||||
Path: name,
|
||||
}
|
||||
resp, ok := fs.getResponse(&r)
|
||||
if !ok {
|
||||
logrus.Errorln("Response to request channel closed")
|
||||
return fs.FileSystem.StatFs(name)
|
||||
}
|
||||
return resp.Statfs
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue