feat: complete shared database tenant sharding
This commit is contained in:
@@ -15,6 +15,7 @@ type testGroupMessageRuntime struct {
|
||||
claims map[string]*groupMessageUniqueRecord
|
||||
seqs map[string]int64
|
||||
shortStates map[string]bool
|
||||
shortValues map[string]string
|
||||
objects map[string][]byte
|
||||
deletedPrefixes []string
|
||||
deletedObjects []string
|
||||
@@ -25,6 +26,7 @@ func newTestGroupMessageRuntime() *testGroupMessageRuntime {
|
||||
claims: make(map[string]*groupMessageUniqueRecord),
|
||||
seqs: make(map[string]int64),
|
||||
shortStates: make(map[string]bool),
|
||||
shortValues: make(map[string]string),
|
||||
objects: make(map[string][]byte),
|
||||
}
|
||||
}
|
||||
@@ -209,8 +211,29 @@ func (r *testGroupMessageRuntime) ClaimShortState(namespace, id string, _ time.D
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (r *testGroupMessageRuntime) ClaimShortStateValue(string, string, string, time.Duration) (bool, bool, error) {
|
||||
return true, true, nil
|
||||
func (r *testGroupMessageRuntime) ClaimShortStateValue(namespace, id, value string, _ time.Duration) (bool, bool, error) {
|
||||
key := namespace + ":" + id
|
||||
if existing, ok := r.shortValues[key]; ok {
|
||||
return false, existing == value, nil
|
||||
}
|
||||
r.shortValues[key] = value
|
||||
return true, false, nil
|
||||
}
|
||||
|
||||
func (r *testGroupMessageRuntime) SetShortStateValue(namespace, id, value string, _ time.Duration) error {
|
||||
r.shortValues[namespace+":"+id] = value
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *testGroupMessageRuntime) GetShortStateValue(namespace, id string) (string, bool, error) {
|
||||
value, ok := r.shortValues[namespace+":"+id]
|
||||
return value, ok, nil
|
||||
}
|
||||
|
||||
func (r *testGroupMessageRuntime) DeleteShortState(namespace, id string) error {
|
||||
delete(r.shortStates, namespace+":"+id)
|
||||
delete(r.shortValues, namespace+":"+id)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *testGroupMessageRuntime) ShortStateExists(namespace, id string) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user