diff --git a/go/vt/key/destination.go b/go/vt/key/destination.go index 235f561c2d7..c4fb37b7a9d 100644 --- a/go/vt/key/destination.go +++ b/go/vt/key/destination.go @@ -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 } @@ -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)) @@ -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 { @@ -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) @@ -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 { @@ -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) @@ -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 { @@ -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) @@ -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 { @@ -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 { @@ -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 { @@ -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