diff options
| author | chrislu <chris.lu@gmail.com> | 2022-03-14 00:03:29 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-03-14 00:03:29 -0700 |
| commit | bd5c5586b5c30389b57e26cc1675044ce1ab3883 (patch) | |
| tree | 9810cc54608f8e1fb02812d51b5572341203ce73 /weed/util/fullpath.go | |
| parent | 5cba8e51c5bb8925b3676b03a368f7816215cc68 (diff) | |
| download | seaweedfs-bd5c5586b5c30389b57e26cc1675044ce1ab3883.tar.xz seaweedfs-bd5c5586b5c30389b57e26cc1675044ce1ab3883.zip | |
generate inode via path and time
Diffstat (limited to 'weed/util/fullpath.go')
| -rw-r--r-- | weed/util/fullpath.go | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/weed/util/fullpath.go b/weed/util/fullpath.go index 6c4f5c6ae..f52d4d1d0 100644 --- a/weed/util/fullpath.go +++ b/weed/util/fullpath.go @@ -1,7 +1,6 @@ package util import ( - "os" "path/filepath" "strings" ) @@ -43,29 +42,9 @@ func (fp FullPath) Child(name string) FullPath { } // AsInode an in-memory only inode representation -func (fp FullPath) AsInode(fileMode os.FileMode) uint64 { +func (fp FullPath) AsInode(unixTime int64) uint64 { inode := uint64(HashStringToLong(string(fp))) - inode = inode - inode%16 - if fileMode == 0 { - } else if fileMode&os.ModeDir > 0 { - inode += 1 - } else if fileMode&os.ModeSymlink > 0 { - inode += 2 - } else if fileMode&os.ModeDevice > 0 { - if fileMode&os.ModeCharDevice > 0 { - inode += 6 - } else { - inode += 3 - } - } else if fileMode&os.ModeNamedPipe > 0 { - inode += 4 - } else if fileMode&os.ModeSocket > 0 { - inode += 5 - } else if fileMode&os.ModeCharDevice > 0 { - inode += 6 - } else if fileMode&os.ModeIrregular > 0 { - inode += 7 - } + inode = inode + uint64(unixTime)*37 return inode } |
