Skip to content
Snippets Groups Projects
pndStore.go 1021 B
Newer Older
  • Learn to ignore specific revisions
  • package nucleus
    
    import (
    	"code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain"
    
    	"code.fbi.h-da.de/danet/gosdn/controller/interfaces/plugin"
    
    	"code.fbi.h-da.de/danet/gosdn/controller/store"
    	log "github.com/sirupsen/logrus"
    
    	"go.mongodb.org/mongo-driver/mongo"
    
    )
    
    // LoadedPnd represents a Principal Network Domain that was loaeded by using
    // the Load() method of the PndStore.
    type LoadedPnd struct {
    	ID          string `json:"id" bson:"_id,omitempty"`
    	Name        string `json:"name,omitempty"`
    	Description string `json:"description,omitempty"`
    }
    
    
    // PndStore is used to store PrincipalNetworkDomains.
    
    // NewPndStore returns a PndStore.
    
    func NewPndStore(db *mongo.Database, pluginService plugin.Service) networkdomain.PndStore {
    
    	storeMode := store.GetStoreMode()
    	log.Debugf("StoreMode: %s", storeMode)
    
    	switch storeMode {
    	case store.Database:
    
    		return NewDatabasePndStore(db, pluginService)
    
    		store := NewFilesystemPndStore(pluginService)