This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed etcd mandatory dependency (#195)
- Loading branch information
Showing
6 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2021 The jackal Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package kv | ||
|
||
import "context" | ||
|
||
// NewNopKV returns a KV that doesn't do anything. | ||
func NewNopKV() KV { return &nopKV{} } | ||
|
||
type nopKV struct{} | ||
|
||
func (k *nopKV) Put(_ context.Context, _ string, _ string) error { return nil } | ||
func (k *nopKV) Get(_ context.Context, _ string) ([]byte, error) { return nil, nil } | ||
|
||
func (k *nopKV) GetPrefix(_ context.Context, _ string) (map[string][]byte, error) { | ||
return nil, nil | ||
} | ||
|
||
func (k *nopKV) Del(_ context.Context, _ string) error { return nil } | ||
|
||
func (k *nopKV) Watch(_ context.Context, _ string, _ bool) <-chan WatchResp { | ||
// return an already closed channel | ||
retCh := make(chan WatchResp) | ||
close(retCh) | ||
return retCh | ||
} | ||
|
||
func (k *nopKV) Start(_ context.Context) error { return nil } | ||
func (k *nopKV) Stop(_ context.Context) error { return nil } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2021 The jackal Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package locker | ||
|
||
import "context" | ||
|
||
// NewNopLocker returns a Locker that doesn't do anything. | ||
func NewNopLocker() Locker { return &nopLocker{} } | ||
|
||
type nopLocker struct{} | ||
|
||
func (l *nopLocker) AcquireLock(_ context.Context, _ string) (Lock, error) { | ||
return &nopLock{}, nil | ||
} | ||
|
||
func (l *nopLocker) Start(_ context.Context) error { return nil } | ||
func (l *nopLocker) Stop(_ context.Context) error { return nil } | ||
|
||
type nopLock struct{} | ||
|
||
func (l *nopLock) Release(_ context.Context) error { return nil } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters