Exemple #1
0
func (s MapStore) isMatch(queryKeys []string, mapKeys []string) bool {
	lqk := len(queryKeys)
	if lqk > len(mapKeys) {
		return false
	}
	for i := 0; i < lqk; i++ {
		if queryKeys[i] != mapKeys[i] {
			return false
		}
	}
	log.Printf("isMatch=true for %s and %s", util.Munge(queryKeys), util.Munge(mapKeys))
	return true
}
Exemple #2
0
func (s MapStore) Get(keys []string) (objects.Storable, error) {
	if len(keys) == 0 {
		return nil, errors.New("No keys")
	}
	key := util.Munge(keys)
	return s.store[key], nil
}
Exemple #3
0
func (s MapStore) Erase(keys []string) error {
	if len(keys) == 0 {
		return errors.New("No keys")
	}
	key := util.Munge(keys)
	delete(s.store, key)
	return nil
}
Exemple #4
0
func (s MapStore) Set(keys []string, obj objects.Storable) error {
	if obj == nil {
		return errors.New("Object is nil")
	}
	if len(keys) == 0 {
		return errors.New("Key is nil")
	}
	k := util.Munge(keys)
	s.store[k] = obj
	return nil
}