store: ClientStore now using chihaya.PeerID
This commit is contained in:
parent
7be6dcaaa3
commit
a64e655376
2 changed files with 8 additions and 4 deletions
|
@ -4,14 +4,17 @@
|
||||||
|
|
||||||
package store
|
package store
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/chihaya/chihaya"
|
||||||
|
)
|
||||||
|
|
||||||
var clientStoreDrivers = make(map[string]ClientStoreDriver)
|
var clientStoreDrivers = make(map[string]ClientStoreDriver)
|
||||||
|
|
||||||
// ClientStore represents an interface for manipulating clientIDs.
|
// ClientStore represents an interface for manipulating clientIDs.
|
||||||
type ClientStore interface {
|
type ClientStore interface {
|
||||||
CreateClient(clientID string) error
|
CreateClient(clientID string) error
|
||||||
FindClient(peerID string) (bool, error)
|
FindClient(peerID chihaya.PeerID) (bool, error)
|
||||||
DeleteClient(clientID string) error
|
DeleteClient(clientID string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ package memory
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/chihaya/chihaya"
|
||||||
"github.com/chihaya/chihaya/pkg/clientid"
|
"github.com/chihaya/chihaya/pkg/clientid"
|
||||||
"github.com/chihaya/chihaya/server/store"
|
"github.com/chihaya/chihaya/server/store"
|
||||||
)
|
)
|
||||||
|
@ -39,8 +40,8 @@ func (s *clientStore) CreateClient(clientID string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *clientStore) FindClient(peerID string) (bool, error) {
|
func (s *clientStore) FindClient(peerID chihaya.PeerID) (bool, error) {
|
||||||
clientID := clientid.New(peerID)
|
clientID := clientid.New(string(peerID))
|
||||||
s.RLock()
|
s.RLock()
|
||||||
defer s.RUnlock()
|
defer s.RUnlock()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue