50 lines
1.6 KiB
C#
50 lines
1.6 KiB
C#
// /**
|
|
// * File: SkyEntities.cs
|
|
// * Author: haraldwolff
|
|
// *
|
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
|
// *
|
|
// *
|
|
// **/
|
|
using System;
|
|
using ln.types.odb;
|
|
using ln.skyscanner.entities;
|
|
using System.IO;
|
|
using LiteDB;
|
|
|
|
namespace ln.skyscanner
|
|
{
|
|
public class SkyEntities
|
|
{
|
|
public SkyScanner SkyScanner { get; }
|
|
public string BasePath => Path.Combine(SkyScanner.BasePath, "entities");
|
|
|
|
public GlobalNetwork GlobalNetwork { get; private set; }
|
|
public ODB odDatabase { get; private set; }
|
|
public ODBCollection<Node> nodeCollection { get; private set; }
|
|
//public ODBCollection<NetworkInterface> interfaceCollection { get; private set; }
|
|
//public ODBCollection<IntfIP> intfIPCollection { get; private set; }
|
|
public ODBCollection<Subnet> subnetCollection { get; private set; }
|
|
|
|
public SkyEntities(SkyScanner skyScanner)
|
|
{
|
|
SkyScanner = skyScanner;
|
|
|
|
odDatabase = new ODB(BasePath);
|
|
nodeCollection = odDatabase.GetCollection<Node>();
|
|
subnetCollection = odDatabase.GetCollection<Subnet>();
|
|
|
|
nodeCollection.EnsureIndex("PrimaryIP");
|
|
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].IP");
|
|
nodeCollection.EnsureIndex("Interfaces[].ConfiguredIPs[].Network");
|
|
|
|
subnetCollection.EnsureIndex("Network");
|
|
|
|
GlobalNetwork = new GlobalNetwork(this);
|
|
}
|
|
|
|
|
|
}
|
|
}
|