Adds storage driver interface, tests, and two basic implementations
This commit is contained in:
26
main/storagedriver/filesystem/filesystem.go
Normal file
26
main/storagedriver/filesystem/filesystem.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/docker/docker-registry/storagedriver/filesystem"
|
||||
"github.com/docker/docker-registry/storagedriver/ipc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
parametersBytes := []byte(os.Args[1])
|
||||
var parameters map[string]interface{}
|
||||
err := json.Unmarshal(parametersBytes, ¶meters)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
rootDirectory := "/tmp/registry"
|
||||
if parameters != nil {
|
||||
rootDirParam, ok := parameters["RootDirectory"].(string)
|
||||
if ok && rootDirParam != "" {
|
||||
rootDirectory = rootDirParam
|
||||
}
|
||||
}
|
||||
ipc.Server(filesystem.NewDriver(rootDirectory))
|
||||
}
|
10
main/storagedriver/inmemory/inmemory.go
Normal file
10
main/storagedriver/inmemory/inmemory.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/docker/docker-registry/storagedriver/inmemory"
|
||||
"github.com/docker/docker-registry/storagedriver/ipc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ipc.Server(inmemory.NewDriver())
|
||||
}
|
Reference in New Issue
Block a user