Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions go/vt/key/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ type Destination interface {
// The returned error must be generated by vterrors.
Resolve([]*topodatapb.ShardReference, func(shard string) error) error

// IsUnique returns true if this is a single destination.
// It returns false if this type can map to multiple destinations.
//
// TODO(alainjobart) That is just a method I think will be useful.
// Mainly, in v3, once we Map(), each returned result should
// be IsUnique=true for a Unique vindex.
IsUnique() bool

// String returns a printable version of the Destination.
String() string
}
Expand All @@ -75,11 +67,6 @@ func DestinationsString(destinations []Destination) string {
// It implements the Destination interface.
type DestinationShard string

// IsUnique is part of the Destination interface.
func (d DestinationShard) IsUnique() bool {
return true
}

// Resolve is part of the Destination interface.
func (d DestinationShard) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
return addShard(string(d))
Expand All @@ -98,11 +85,6 @@ func (d DestinationShard) String() string {
// It implements the Destination interface.
type DestinationShards []string

// IsUnique is part of the Destination interface.
func (d DestinationShards) IsUnique() bool {
return false
}

// Resolve is part of the Destination interface.
func (d DestinationShards) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
for _, shard := range d {
Expand Down Expand Up @@ -134,11 +116,6 @@ type DestinationExactKeyRange struct {
KeyRange *topodatapb.KeyRange
}

// IsUnique is part of the Destination interface.
func (d DestinationExactKeyRange) IsUnique() bool {
return true
}

// Resolve is part of the Destination interface.
func (d DestinationExactKeyRange) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
return processExactKeyRange(allShards, d.KeyRange, addShard)
Expand Down Expand Up @@ -188,11 +165,6 @@ func processExactKeyRange(allShards []*topodatapb.ShardReference, kr *topodatapb
// It implements the Destination interface.
type DestinationExactKeyRanges []*topodatapb.KeyRange

// IsUnique is part of the Destination interface.
func (d DestinationExactKeyRanges) IsUnique() bool {
return false
}

// Resolve is part of the Destination interface.
func (d DestinationExactKeyRanges) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
for _, kr := range d {
Expand Down Expand Up @@ -231,11 +203,6 @@ type DestinationKeyRange struct {
KeyRange *topodatapb.KeyRange
}

// IsUnique is part of the Destination interface.
func (d DestinationKeyRange) IsUnique() bool {
return true
}

// Resolve is part of the Destination interface.
func (d DestinationKeyRange) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
return processKeyRange(allShards, d.KeyRange, addShard)
Expand Down Expand Up @@ -267,11 +234,6 @@ func processKeyRange(allShards []*topodatapb.ShardReference, kr *topodatapb.KeyR
// It implements the Destination interface.
type DestinationKeyRanges []*topodatapb.KeyRange

// IsUnique is part of the Destination interface.
func (d DestinationKeyRanges) IsUnique() bool {
return false
}

// Resolve is part of the Destination interface.
func (d DestinationKeyRanges) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
for _, kr := range d {
Expand Down Expand Up @@ -304,11 +266,6 @@ func (d DestinationKeyRanges) String() string {
// It implements the Destination interface.
type DestinationKeyspaceID []byte

// IsUnique is part of the Destination interface.
func (d DestinationKeyspaceID) IsUnique() bool {
return true
}

// Resolve is part of the Destination interface.
func (d DestinationKeyspaceID) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
shard, err := GetShardForKeyspaceID(allShards, d)
Expand Down Expand Up @@ -345,11 +302,6 @@ func GetShardForKeyspaceID(allShards []*topodatapb.ShardReference, keyspaceID []
// It implements the Destination interface.
type DestinationKeyspaceIDs [][]byte

// IsUnique is part of the Destination interface.
func (d DestinationKeyspaceIDs) IsUnique() bool {
return false
}

// Resolve is part of the Destination interface.
func (d DestinationKeyspaceIDs) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
for _, ksid := range d {
Expand Down Expand Up @@ -400,11 +352,6 @@ func (dp DestinationAnyShardPickerRandomShard) PickShard(shardCount int) int {
// It implements the Destination interface.
type DestinationAnyShard struct{}

// IsUnique is part of the Destination interface.
func (d DestinationAnyShard) IsUnique() bool {
return true
}

// Resolve is part of the Destination interface.
func (d DestinationAnyShard) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
if len(allShards) == 0 {
Expand All @@ -427,11 +374,6 @@ func (d DestinationAnyShard) String() string {
// It implements the Destination interface.
type DestinationAllShards struct{}

// IsUnique is part of the Destination interface.
func (d DestinationAllShards) IsUnique() bool {
return false
}

// Resolve is part of the Destination interface.
func (d DestinationAllShards) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
for _, shard := range allShards {
Expand All @@ -456,11 +398,6 @@ func (d DestinationAllShards) String() string {
// It implements the Destination interface.
type DestinationNone struct{}

// IsUnique is part of the Destination interface.
func (d DestinationNone) IsUnique() bool {
return true
}

// Resolve is part of the Destination interface.
func (d DestinationNone) Resolve(allShards []*topodatapb.ShardReference, addShard func(shard string) error) error {
return nil
Expand Down