Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1345 from lowzj/locator-add-select
Browse files Browse the repository at this point in the history
feature: add Select api into SupernodeLocator
  • Loading branch information
lowzj authored May 18, 2020
2 parents f131b5f + 9864570 commit d499c51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dfget/locator/locator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type SupernodeLocator interface {
// purpose. The current supernode should be set as this result.
Next() *Supernode

// Select chooses a supernode based on the giving key.
// It should not affect the result of method 'Get()'.
Select(key interface{}) *Supernode

// GetGroup returns the group with the giving name.
GetGroup(name string) *SupernodeGroup

Expand Down
5 changes: 5 additions & 0 deletions dfget/locator/static_locator.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ func (s *StaticLocator) Next() *Supernode {
return s.Group.GetNode(s.inc())
}

func (s *StaticLocator) Select(key interface{}) *Supernode {
// unnecessary to implement this method
return nil
}

func (s *StaticLocator) GetGroup(name string) *SupernodeGroup {
if s.Group == nil || s.Group.Name != name {
return nil
Expand Down

0 comments on commit d499c51

Please sign in to comment.