Skip to content

Commit

Permalink
Merge pull request #293 from sonroyaalmerol/march-1
Browse files Browse the repository at this point in the history
add tests for async i/o
  • Loading branch information
sonroyaalmerol authored Mar 2, 2025
2 parents efc0ffe + 45b3add commit 0955070
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 106 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/sonroyaalmerol/pbs-plus
go 1.24.0

require (
github.com/Microsoft/go-winio v0.6.2
github.com/alexflint/go-filemutex v1.3.0
github.com/alphadose/haxmap v1.4.1
github.com/billgraziano/dpapi v0.5.0
Expand All @@ -14,6 +15,7 @@ require (
github.com/hanwen/go-fuse/v2 v2.7.2
github.com/kardianos/service v1.2.2
github.com/mxk/go-vss v1.2.0
github.com/rekby/fastuuid v0.9.0
github.com/stretchr/testify v1.10.0
github.com/tinylib/msgp v1.2.5
github.com/xtaci/smux v1.5.34
Expand All @@ -26,7 +28,6 @@ require (
)

require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/getlantern/context v0.0.0-20220418194847-3d5e7a086201 // indirect
github.com/getlantern/errors v1.0.4 // indirect
Expand All @@ -43,6 +44,7 @@ require (
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/valyala/fastrand v1.1.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.34.0 // indirect
go.opentelemetry.io/otel/metric v1.34.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rekby/fastuuid v0.9.0 h1:iQk8V/AyqSrgQAtKRdqx/CVep+CaKwaSWeerw1yEP3Q=
github.com/rekby/fastuuid v0.9.0/go.mod h1:qP8Lh0BH2+4rNGVRDHmDpkvE/ZuLUhjmKpRWjx+WesY=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
Expand All @@ -101,6 +103,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tinylib/msgp v1.2.5 h1:WeQg1whrXRFiZusidTQqzETkRpGjFjcIhW6uqWH09po=
github.com/tinylib/msgp v1.2.5/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
github.com/valyala/fastrand v1.1.0 h1:f+5HkLW4rsgzdNoleUOB69hyT9IlD2ZQh9GyDMfb5G8=
github.com/valyala/fastrand v1.1.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
github.com/xtaci/smux v1.5.34 h1:OUA9JaDFHJDT8ZT3ebwLWPAgEfE6sWo2LaTy3anXqwg=
github.com/xtaci/smux v1.5.34/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
Expand Down
9 changes: 3 additions & 6 deletions internal/agent/vssfs/vssfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"path/filepath"
"time"

"github.com/Microsoft/go-winio"
"github.com/alphadose/haxmap"
securejoin "github.com/cyphar/filepath-securejoin"
"github.com/rekby/fastuuid"
"github.com/sonroyaalmerol/pbs-plus/internal/arpc"
"github.com/sonroyaalmerol/pbs-plus/internal/utils/hashmap"
"github.com/xtaci/smux"
Expand Down Expand Up @@ -176,14 +176,11 @@ func (s *VSSFSServer) handleOpenFile(req arpc.Request) (*arpc.Response, error) {
return nil, err
}

fileIDInfo, err := winio.GetFileID(f)
handleId, err := fastuuid.UUIDv4String()
if err != nil {
f.Close()
return nil, err
return nil, os.ErrInvalid
}

handleId := fileIDToKey(fileIDInfo)

fh := &FileHandle{
handle: handle,
file: f,
Expand Down
Loading

0 comments on commit 0955070

Please sign in to comment.