Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
e716c147
Commit
e716c147
authored
9 years ago
by
Eric Chiang
Browse files
Options
Downloads
Patches
Plain Diff
storage: remove current registration process for new storages
parent
c7af2c48
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
storage/memory/memory.go
+0
-13
0 additions, 13 deletions
storage/memory/memory.go
storage/storage.go
+0
-31
0 additions, 31 deletions
storage/storage.go
with
0 additions
and
44 deletions
storage/memory/memory.go
+
0
−
13
View file @
e716c147
...
@@ -8,10 +8,6 @@ import (
...
@@ -8,10 +8,6 @@ import (
"github.com/coreos/poke/storage"
"github.com/coreos/poke/storage"
)
)
func
init
()
{
storage
.
Register
(
"memory"
,
new
(
driver
))
}
// New returns an in memory storage.
// New returns an in memory storage.
func
New
()
storage
.
Storage
{
func
New
()
storage
.
Storage
{
return
&
memStorage
{
return
&
memStorage
{
...
@@ -22,15 +18,6 @@ func New() storage.Storage {
...
@@ -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
{
type
memStorage
struct
{
mu
sync
.
Mutex
mu
sync
.
Mutex
...
...
This diff is collapsed.
Click to expand it.
storage/storage.go
+
0
−
31
View file @
e716c147
...
@@ -16,8 +16,6 @@ import (
...
@@ -16,8 +16,6 @@ import (
)
)
var
(
var
(
drivers
=
make
(
map
[
string
]
Driver
)
// stubbed out for testing
// stubbed out for testing
now
=
time
.
Now
now
=
time
.
Now
)
)
...
@@ -40,35 +38,6 @@ func NewNonce() string {
...
@@ -40,35 +38,6 @@ func NewNonce() string {
return
strings
.
TrimRight
(
encoding
.
EncodeToString
(
buff
),
"="
)
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
// Storage is the storage interface used by the server. Implementations, at minimum
// require compare-and-swap atomic actions.
// require compare-and-swap atomic actions.
//
//
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment