mirror of
https://github.com/restic/rest-server.git
synced 2026-09-25 13:31:31 -07:00
Create data hash folders during startup, too
So, that we are not constantly trying to mkdir() what is already there. This is a small performance improvement.
This commit is contained in:
@@ -197,7 +197,6 @@ func SaveBlob(c *Context) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if dir == "data" {
|
if dir == "data" {
|
||||||
os.MkdirAll(filepath.Join(c.path, dir, name[:2]), 0700)
|
|
||||||
name = filepath.Join(name[:2], name)
|
name = filepath.Join(name[:2], name)
|
||||||
}
|
}
|
||||||
path := filepath.Join(c.path, dir, name)
|
path := filepath.Join(c.path, dir, name)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@@ -29,6 +30,9 @@ func main() {
|
|||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
os.MkdirAll(filepath.Join(*path, d), 0700)
|
os.MkdirAll(filepath.Join(*path, d), 0700)
|
||||||
}
|
}
|
||||||
|
for i := 0; i < 256; i++ {
|
||||||
|
os.MkdirAll(filepath.Join(*path, "data", fmt.Sprintf("%02x", i)), 0700)
|
||||||
|
}
|
||||||
|
|
||||||
// Define the routes.
|
// Define the routes.
|
||||||
context := &Context{*path}
|
context := &Context{*path}
|
||||||
|
|||||||
Reference in New Issue
Block a user