MCPcopy Create free account
hub / github.com/easierway/concurrent_map / Partitionable

Interface Partitionable

concurrent_map.go:17–31  ·  view source on GitHub ↗

Partitionable is the interface which should be implemented by key type. It is to define how to partition the entries.

Source from the content-addressed store, hash-verified

15// Partitionable is the interface which should be implemented by key type.
16// It is to define how to partition the entries.
17type Partitionable interface {
18 // Value is raw value of the key
19 Value() interface{}
20
21 // PartitionKey is used for getting the partition to store the entry with the key.
22 // E.g. the key's hash could be used as its PartitionKey
23 // The partition for the key is partitions[(PartitionKey % m.numOfBlockets)]
24 //
25 // 1 Why not provide the default hash function for partition?
26 // Ans: As you known, the partition solution would impact the performance significantly.
27 // The proper partition solution balances the access to the different partitions and
28 // avoid of the hot partition. The access mode highly relates to your business.
29 // So, the better partition solution would just be designed according to your business.
30 PartitionKey() int64
31}
32
33type innerMap struct {
34 m map[interface{}]interface{}

Callers 4

getMethod · 0.65
setMethod · 0.65
delMethod · 0.65
getPartitionMethod · 0.65

Implementers 2

StringKeystring_key.go
Int64Keyint64_key.go

Calls

no outgoing calls

Tested by

no test coverage detected