Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
sbiStore.go 616 B
package nucleus

import (
	"fmt"

	"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
	"code.fbi.h-da.de/danet/gosdn/controller/store"

	"github.com/google/uuid"
)

// SbiStore is used to store SouthboundInterfaces
type SbiStore struct {
	sbiStoreName string
}

// NewSbiStore returns a sbiStore
func NewSbiStore(pndUUID uuid.UUID) southbound.Store {
	storeMode := store.GetStoreMode()

	switch storeMode {
	case store.Database:
		return &DatabaseSbiStore{
			sbiStoreName: fmt.Sprintf("sbi-store-%s.json", pndUUID.String()),
		}

	default:
		store := NewFilesystemSbiStore(pndUUID)
		return store
	}
}