Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
e716c147
Commit
e716c147
authored
Aug 03, 2016
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: remove current registration process for new storages
parent
c7af2c48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
44 deletions
+0
-44
memory.go
storage/memory/memory.go
+0
-13
storage.go
storage/storage.go
+0
-31
No files found.
storage/memory/memory.go
View file @
e716c147
...
...
@@ -8,10 +8,6 @@ import (
"github.com/coreos/poke/storage"
)
func
init
()
{
storage
.
Register
(
"memory"
,
new
(
driver
))
}
// New returns an in memory storage.
func
New
()
storage
.
Storage
{
return
&
memStorage
{
...
...
@@ -22,15 +18,6 @@ func New() storage.Storage {
}
}
type
driver
struct
{}
func
(
f
*
driver
)
Open
(
config
map
[
string
]
string
)
(
storage
.
Storage
,
error
)
{
if
len
(
config
)
!=
0
{
return
nil
,
errors
.
New
(
"in memory storage does not take any arguments"
)
}
return
New
(),
nil
}
type
memStorage
struct
{
mu
sync
.
Mutex
...
...
storage/storage.go
View file @
e716c147
...
...
@@ -16,8 +16,6 @@ import (
)
var
(
drivers
=
make
(
map
[
string
]
Driver
)
// stubbed out for testing
now
=
time
.
Now
)
...
...
@@ -40,35 +38,6 @@ func NewNonce() string {
return
strings
.
TrimRight
(
encoding
.
EncodeToString
(
buff
),
"="
)
}
// Driver is the interface implemented by storage drivers.
type
Driver
interface
{
// Open returns a storage implementation. It should only validate its
// arguments and not return an error if the underlying storage is
// unavailable.
Open
(
config
map
[
string
]
string
)
(
Storage
,
error
)
}
// Register makes a storage driver available by the provided name. If Register
// is called twice with the same name or if driver is nil, it panics.
func
Register
(
name
string
,
driver
Driver
)
{
if
driver
==
nil
{
panic
(
"driver cannot be nil"
)
}
if
_
,
ok
:=
drivers
[
name
];
ok
{
panic
(
"driver "
+
name
+
" is already registered"
)
}
drivers
[
name
]
=
driver
}
// Open returns a new storage object with a given key rotation strategy.
func
Open
(
driverName
string
,
config
map
[
string
]
string
)
(
Storage
,
error
)
{
driver
,
ok
:=
drivers
[
driverName
]
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"no driver of type %s found"
,
driverName
)
}
return
driver
.
Open
(
config
)
}
// Storage is the storage interface used by the server. Implementations, at minimum
// require compare-and-swap atomic actions.
//
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment