Skip to content

Commit

Permalink
Update/longtail v0.2.16 (#197)
Browse files Browse the repository at this point in the history
* Update longtail lib to 0.2.16
* fix lint issues
* Fix UNC path handling in NormalizePath
* release notes
  • Loading branch information
DanEngelbrecht authored Feb 25, 2022
1 parent a47b60c commit 937ca90
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ jobs:
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- **UPDATED** Updated longtail to v0.2.14 - fixes handling of non-ascii file names on Windows
- **UPDATED** Updated longtail to v0.2.16 - fixes handling of UNC paths
- **FIX** Minor logging tweaks
draft: false
prerelease: false
- name: Download Linux artifacts
Expand Down
Binary file modified longtaillib/longtail/liblongtail_darwin_x64.a
Binary file not shown.
Binary file modified longtaillib/longtail/liblongtail_linux_x64.a
Binary file not shown.
Binary file modified longtaillib/longtail/liblongtail_win32_x64.a
Binary file not shown.
2 changes: 1 addition & 1 deletion longtailutils/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func ParseLevel(lvl string) (int, error) {
return 4, nil
}

return -1, errors.Wrap(fmt.Errorf("Invalid log Level: %s", lvl), fname)
return -1, errors.Wrap(fmt.Errorf("invalid log Level: %s", lvl), fname)
}

// AssertData ...
Expand Down
20 changes: 18 additions & 2 deletions longtailutils/longtailutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/pkg/errors"

"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
)

type getExistingContentCompletionAPI struct {
Expand All @@ -23,6 +22,10 @@ type getExistingContentCompletionAPI struct {

func (a *getExistingContentCompletionAPI) OnComplete(storeIndex longtaillib.Longtail_StoreIndex, err error) {
const fname = "getExistingContentCompletionAPI.OnComplete"
log := logrus.WithContext(context.Background()).WithFields(logrus.Fields{
"fname": fname,
"err": err,
})
log.Debug(fname)
a.err = err
a.storeIndex = storeIndex
Expand All @@ -37,6 +40,11 @@ type pruneBlocksCompletionAPI struct {

func (a *pruneBlocksCompletionAPI) OnComplete(prunedBlockCount uint32, err error) {
const fname = "pruneBlocksCompletionAPI.OnComplete"
log := logrus.WithContext(context.Background()).WithFields(logrus.Fields{
"fname": fname,
"prunedBlockCount": prunedBlockCount,
"err": err,
})
log.Debug(fname)
a.prunedBlockCount = prunedBlockCount
a.wg.Done()
Expand All @@ -50,6 +58,10 @@ type flushCompletionAPI struct {

func (a *flushCompletionAPI) OnComplete(err error) {
const fname = "flushCompletionAPI.OnComplete"
log := logrus.WithContext(context.Background()).WithFields(logrus.Fields{
"fname": fname,
"err": err,
})
log.Debug(fname)
a.err = err
a.wg.Done()
Expand All @@ -64,6 +76,10 @@ type GetStoredBlockCompletionAPI struct {

func (a *GetStoredBlockCompletionAPI) OnComplete(storedBlock longtaillib.Longtail_StoredBlock, err error) {
const fname = "GetStoredBlockCompletionAPI.OnComplete"
log := logrus.WithContext(context.Background()).WithFields(logrus.Fields{
"fname": fname,
"err": err,
})
log.Debug(fname)
a.Err = err
a.StoredBlock = storedBlock
Expand Down Expand Up @@ -459,7 +475,7 @@ func GetCompressionType(compressionAlgorithm string) (uint32, error) {
if compressionType, exists := compressionTypeMap[compressionAlgorithm]; exists {
return compressionType, nil
}
err := fmt.Errorf("Unsupported compression algorithm: `%s`", compressionAlgorithm)
err := fmt.Errorf("unsupported compression algorithm: `%s`", compressionAlgorithm)
return 0, errors.Wrap(err, fname)
}

Expand Down
9 changes: 7 additions & 2 deletions longtailutils/pathfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ import (
log "github.com/sirupsen/logrus"
)

const uncprefix = "\\\\?\\"

func NormalizePath(path string) string {
doubleForwardRemoved := strings.Replace(path, "//", "/", -1)
if strings.HasPrefix(doubleForwardRemoved, uncprefix) {
doubleBackwardRemoved := uncprefix + strings.Replace(doubleForwardRemoved[4:], "\\\\", "\\", -1)
return doubleBackwardRemoved
}
doubleBackwardRemoved := strings.Replace(doubleForwardRemoved, "\\\\", "/", -1)
backwardRemoved := strings.Replace(doubleBackwardRemoved, "\\", "/", -1)
return backwardRemoved
return doubleBackwardRemoved
}

type regexPathFilter struct {
Expand Down

0 comments on commit 937ca90

Please sign in to comment.