Skip to content

Commit

Permalink
Support file operations for FUSE
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Nov 3, 2022
1 parent c952df9 commit ef42fba
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 23 deletions.
7 changes: 4 additions & 3 deletions pkg/controlplane/http/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import (
"net/http"
"net/url"
"strconv"
"syscall"
"time"

"github.com/v3io/v3io-go/pkg/controlplane"
"github.com/v3io/v3io-go/pkg/errors"
v3ioc "github.com/v3io/v3io-go/pkg/controlplane"
v3ioerrors "github.com/v3io/v3io-go/pkg/errors"

"github.com/nuclio/errors"
"github.com/nuclio/logger"
Expand Down Expand Up @@ -839,7 +840,7 @@ func (s *session) sendRequest(ctx context.Context, request *request, timeout tim
return nil, v3ioerrors.NewErrorWithStatusCode(
fmt.Errorf("Failed to execute HTTP request %s/%s.\nResponse code: %d",
s.endpoints[0], request.path, responseInstance.statusCode),
responseInstance.statusCode)
responseInstance.statusCode, int(syscall.EINVAL))
}
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/dataplane/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,11 @@ type Container interface {

// PutOOSObjectSync
PutOOSObjectSync(*PutOOSObjectInput) error

GetFileAttributesSync(*GetFileAttributesInput, *GetFileAttributesOutput) error
OpenFileSync(*OpenFileInput, *OpenFileOutput) error
CloseFileSync(*CloseFileInput) error
TruncateFileSync(*TruncateFileInput) error
SymlinkSync(*SymlinkInput) error
GetWorkerDedicatedPortsSync(*DataPlaneInput) ([]string, error)
}
31 changes: 30 additions & 1 deletion pkg/dataplane/http/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ such restriction.
package v3iohttp

import (
"github.com/v3io/v3io-go/pkg/dataplane"
v3io "github.com/v3io/v3io-go/pkg/dataplane"

"github.com/nuclio/logger"
)
Expand Down Expand Up @@ -314,3 +314,32 @@ func (c *container) PutOOSObjectSync(putOOSObjectInput *v3io.PutOOSObjectInput)
c.populateInputFields(&putOOSObjectInput.DataPlaneInput)
return c.session.context.PutOOSObjectSync(putOOSObjectInput)
}

func (c *container) GetFileAttributesSync(input *v3io.GetFileAttributesInput, out *v3io.GetFileAttributesOutput) error {
c.populateInputFields(&input.DataPlaneInput)
return c.session.context.GetFileAttributesSync(input, out)
}

func (c *container) OpenFileSync(input *v3io.OpenFileInput, out *v3io.OpenFileOutput) error {
c.populateInputFields(&input.DataPlaneInput)
return c.session.context.OpenFileSync(input, out)
}

func (c *container) CloseFileSync(input *v3io.CloseFileInput) error {
c.populateInputFields(&input.DataPlaneInput)
return c.session.context.CloseFileSync(input)
}

func (c *container) TruncateFileSync(input *v3io.TruncateFileInput) error {
c.populateInputFields(&input.DataPlaneInput)
return c.session.context.TruncateFileSync(input)
}

func (c *container) SymlinkSync(input *v3io.SymlinkInput) error {
c.populateInputFields(&input.DataPlaneInput)
return c.session.context.SymlinkSync(input)
}

func (c *container) GetWorkerDedicatedPortsSync(in *v3io.DataPlaneInput) ([]string, error) {
return c.session.context.GetWorkerDedicatedPortsSync(in)
}
Loading

0 comments on commit ef42fba

Please sign in to comment.