Skip to content

Commit

Permalink
Readme hash-filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
lomik committed Feb 9, 2018
1 parent ebb4601 commit 92f9aba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -101,6 +101,9 @@ sparse-create = false
# use flock on every file call (ensures consistency if there are concurrent read/writes to the same file)
flock = false
enabled = true
# Use hashed filenames for tagged metrics instead of human readable
# https://github.com/lomik/go-carbon/pull/225
hash-filenames = true

[cache]
# Limit of in-memory stored points (not metrics)
Expand Down Expand Up @@ -239,7 +242,6 @@ buffer-size = 0
# receiver_max_messages = 1000
# receiver_max_bytes = 500000000 # default 500MB


[carbonlink]
listen = "127.0.0.1:7002"
enabled = true
Expand Down
3 changes: 3 additions & 0 deletions deploy/go-carbon.conf
Expand Up @@ -25,6 +25,9 @@ sparse-create = false
# use flock on every file call (ensures consistency if there are concurrent read/writes to the same file)
flock = false
enabled = true
# Use hashed filenames for tagged metrics instead of human readable
# https://github.com/lomik/go-carbon/pull/225
hash-filenames = true

[cache]
# Limit of in-memory stored points (not metrics)
Expand Down
4 changes: 2 additions & 2 deletions tags/normalize.go
Expand Up @@ -98,10 +98,10 @@ func Normalize(s string) (string, error) {
return strings.Join(arr[:len(arr)-toDel], ";"), nil
}

func FilePath(root string, s string, hash_only bool) string {
func FilePath(root string, s string, hashOnly bool) string {
sum := sha256.Sum256([]byte(s))
hash := fmt.Sprintf("%x", sum)
if hash_only == true {
if hashOnly == true {
return filepath.Join(root, "_tagged", hash[:3], hash[3:6], hash)
} else {
return filepath.Join(root, "_tagged", hash[:3], hash[3:6], strings.Replace(s, ".", "_DOT_", -1))
Expand Down

0 comments on commit 92f9aba

Please sign in to comment.