mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-02 00:44:53 -05:00
f13530425a
rollback indexer map use sync.pool for cache entries add tests for cache remove main locks from nrwmutex and use sync.map and sync.pool instead bump dockerfile go version
28 lines
638 B
Go
28 lines
638 B
Go
package indexer
|
|
|
|
import "github.com/owncloud/ocis/ocis-pkg/indexer/index"
|
|
|
|
// typeMap stores the indexer layout at runtime.
|
|
|
|
type typeMap map[tName]typeMapping
|
|
type tName = string
|
|
type fieldName = string
|
|
|
|
type typeMapping struct {
|
|
PKFieldName string
|
|
IndicesByField map[fieldName][]index.Index
|
|
}
|
|
|
|
func (m typeMap) addIndex(typeName string, pkName string, idx index.Index) {
|
|
if val, ok := m[typeName]; ok {
|
|
val.IndicesByField[idx.IndexBy()] = append(val.IndicesByField[idx.IndexBy()], idx)
|
|
return
|
|
}
|
|
m[typeName] = typeMapping{
|
|
PKFieldName: pkName,
|
|
IndicesByField: map[string][]index.Index{
|
|
idx.IndexBy(): {idx},
|
|
},
|
|
}
|
|
}
|