Implement filesystem stores
We want to provide three different storage options, memory, filesystem and database. Currently filesystem is not implemented (e.g. see https://code.fbi.h-da.de/danet/gosdn/-/blob/develop/controller/nucleus/pndStore.go#L40).
This should also be possible with generics, check https://code.fbi.h-da.de/danet/gosdn/-/blob/develop/controller/nucleus/genericStore.go for the in-memory implementation.
This is needed for the following stores:
UUID are unique, that means the store should check that there can't be two. Prototype for this in utils:
func CheckForDuplicateUUIDs[T store.LoadedStorable](objects []T) error {
var uuids = make(map[uuid.UUID]bool)
for _, object := range objects {
_, uuidExists := uuids[object.GetID()]
if uuidExists {
return &errors.ErrAlreadyExists{Item: object}
}
uuids[object.GetID()] = true
}
return nil
}
func CheckForDuplicatePndUUIDs[T store.Storable](objects []T) error {
var uuids = make(map[uuid.UUID]bool)
for _, object := range objects {
_, uuidExists := uuids[object.ID()]
if uuidExists {
return &errors.ErrAlreadyExists{Item: object}
}
uuids[object.ID()] = true
}
return nil
}
-
PND -
Device -
SBI -
User -
Role -
Ensure that duplicate uuids are not possible
Edited by Ghost User