forked from weaviate/weaviate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use mmap-go for windows support
* feat: use mmap-go for windows support * test: fix tests for windows * test: fix connection refused tests * test: fix single prop test * style: gofumpt * test: fix old prop tracker test * fix: rm commit log close
- Loading branch information
1 parent
e9195aa
commit ec37dbc
Showing
21 changed files
with
232 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// _ _ | ||
// __ _____ __ ___ ___ __ _| |_ ___ | ||
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ | ||
// \ V V / __/ (_| |\ V /| | (_| | || __/ | ||
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| | ||
// | ||
// Copyright © 2016 - 2023 Weaviate B.V. All rights reserved. | ||
// | ||
// CONTACT: hello@weaviate.io | ||
//go:build !windows | ||
|
||
package db | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
func (d *DB) getDiskUse(diskPath string) diskUse { | ||
fs := syscall.Statfs_t{} | ||
|
||
err := syscall.Statfs(diskPath, &fs) | ||
if err != nil { | ||
d.logger.WithField("action", "read_disk_use"). | ||
WithField("path", diskPath). | ||
Errorf("failed to read disk usage: %s", err) | ||
} | ||
|
||
return diskUse{ | ||
total: fs.Blocks * uint64(fs.Bsize), | ||
free: fs.Bfree * uint64(fs.Bsize), | ||
avail: fs.Bfree * uint64(fs.Bsize), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// _ _ | ||
// __ _____ __ ___ ___ __ _| |_ ___ | ||
// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ | ||
// \ V V / __/ (_| |\ V /| | (_| | || __/ | ||
// \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| | ||
// | ||
// Copyright © 2016 - 2023 Weaviate B.V. All rights reserved. | ||
// | ||
// CONTACT: hello@weaviate.io | ||
//go:build windows | ||
|
||
package db | ||
|
||
import ( | ||
"syscall" | ||
|
||
"golang.org/x/sys/windows" | ||
) | ||
|
||
func (d *DB) getDiskUse(diskPath string) diskUse { | ||
var freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes uint64 | ||
|
||
_, _ = syscall.UTF16PtrFromString(diskPath) | ||
|
||
err := windows.GetDiskFreeSpaceEx( | ||
syscall.StringToUTF16Ptr(diskPath), | ||
&freeBytesAvailable, | ||
&totalNumberOfBytes, | ||
&totalNumberOfFreeBytes, | ||
) | ||
if err != nil { | ||
d.logger.WithField("action", "read_disk_use"). | ||
WithField("path", diskPath). | ||
Errorf("failed to read disk usage: %s", err) | ||
} | ||
|
||
return diskUse{ | ||
total: totalNumberOfBytes, | ||
free: totalNumberOfFreeBytes, | ||
avail: freeBytesAvailable, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.