Sorted the fields and properties and added members for Repositories.

Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
Konstantina Chremmou 2023-05-25 23:11:31 +01:00
parent c439f3de41
commit 2c3e4fd140
2 changed files with 52 additions and 44 deletions

View File

@ -45,65 +45,68 @@ namespace XenAdmin.Network
public class Cache : ICache
{
#pragma warning disable 0414
// keep sorted please
private readonly ChangeableDictionary<XenRef<Bond>, Bond> _bond = new ChangeableDictionary<XenRef<Bond>, Bond>();
private readonly ChangeableDictionary<XenRef<Blob>, Blob> _blob = new ChangeableDictionary<XenRef<Blob>, Blob>();
private readonly ChangeableDictionary<XenRef<Cluster>, Cluster> _cluster = new ChangeableDictionary<XenRef<Cluster>, Cluster>();
private readonly ChangeableDictionary<XenRef<Bond>, Bond> _bond = new ChangeableDictionary<XenRef<Bond>, Bond>();
private readonly ChangeableDictionary<XenRef<Certificate>, Certificate> _certificates = new ChangeableDictionary<XenRef<Certificate>, Certificate>();
private readonly ChangeableDictionary<XenRef<Cluster_host>, Cluster_host> _cluster_host = new ChangeableDictionary<XenRef<Cluster_host>, Cluster_host>();
private readonly ChangeableDictionary<XenRef<Cluster>, Cluster> _cluster = new ChangeableDictionary<XenRef<Cluster>, Cluster>();
private readonly ChangeableDictionary<XenRef<XenAPI.Console>, XenAPI.Console> _console = new ChangeableDictionary<XenRef<XenAPI.Console>, XenAPI.Console>();
private readonly ChangeableDictionary<XenRef<Crashdump>, Crashdump> _crashdump = new ChangeableDictionary<XenRef<Crashdump>, Crashdump>();
private readonly ChangeableDictionary<XenRef<DockerContainer>, DockerContainer> _dockerContainers = new ChangeableDictionary<XenRef<DockerContainer>, DockerContainer>();
private readonly ChangeableDictionary<XenRef<Feature>, Feature> _feature = new ChangeableDictionary<XenRef<Feature>, Feature>();
private readonly ChangeableDictionary<XenRef<Folder>, Folder> _folders = new ChangeableDictionary<XenRef<Folder>, Folder>();
private readonly ChangeableDictionary<XenRef<DockerContainer>, DockerContainer> _dockerContainers = new ChangeableDictionary<XenRef<DockerContainer>, DockerContainer>();
private readonly ChangeableDictionary<XenRef<GPU_group>, GPU_group> _gpu_groups = new ChangeableDictionary<XenRef<GPU_group>, GPU_group>();
private readonly ChangeableDictionary<XenRef<Host>, Host> _host = new ChangeableDictionary<XenRef<Host>, Host>();
private readonly ChangeableDictionary<XenRef<Host_cpu>, Host_cpu> _host_cpu = new ChangeableDictionary<XenRef<Host_cpu>, Host_cpu>();
private readonly ChangeableDictionary<XenRef<Host_crashdump>, Host_crashdump> _host_crashdump = new ChangeableDictionary<XenRef<Host_crashdump>, Host_crashdump>();
private readonly ChangeableDictionary<XenRef<Host_metrics>, Host_metrics> _host_metrics = new ChangeableDictionary<XenRef<Host_metrics>, Host_metrics>();
private readonly ChangeableDictionary<XenRef<Host_patch>, Host_patch> _host_patch = new ChangeableDictionary<XenRef<Host_patch>, Host_patch>();
private readonly ChangeableDictionary<XenRef<Host>, Host> _host = new ChangeableDictionary<XenRef<Host>, Host>();
private readonly ChangeableDictionary<XenRef<Message>, Message> _message = new ChangeableDictionary<XenRef<Message>, Message>();
private readonly ChangeableDictionary<XenRef<Network_sriov>, Network_sriov> _network_sriov = new ChangeableDictionary<XenRef<Network_sriov>, Network_sriov>();
private readonly ChangeableDictionary<XenRef<XenAPI.Network>, XenAPI.Network> _network = new ChangeableDictionary<XenRef<XenAPI.Network>, XenAPI.Network>();
private readonly ChangeableDictionary<XenRef<XenAPI.Network_sriov>, XenAPI.Network_sriov> _network_sriov = new ChangeableDictionary<XenRef<XenAPI.Network_sriov>, XenAPI.Network_sriov>();
private readonly ChangeableDictionary<XenRef<PBD>, PBD> _pbd = new ChangeableDictionary<XenRef<PBD>, PBD>();
private readonly ChangeableDictionary<XenRef<PUSB>, PUSB> _pusb = new ChangeableDictionary<XenRef<PUSB>, PUSB>();
private readonly ChangeableDictionary<XenRef<VUSB>, VUSB> _vusb = new ChangeableDictionary<XenRef<VUSB>, VUSB>();
private readonly ChangeableDictionary<XenRef<USB_group>, USB_group> _usb_group = new ChangeableDictionary<XenRef<USB_group>, USB_group>();
private readonly ChangeableDictionary<XenRef<PCI>, PCI> _pcis = new ChangeableDictionary<XenRef<PCI>, PCI>();
private readonly ChangeableDictionary<XenRef<PGPU>, PGPU> _pgpu = new ChangeableDictionary<XenRef<PGPU>, PGPU>();
private readonly ChangeableDictionary<XenRef<PIF>, PIF> _pif = new ChangeableDictionary<XenRef<PIF>, PIF>();
private readonly ChangeableDictionary<XenRef<PIF_metrics>, PIF_metrics> _pif_metrics = new ChangeableDictionary<XenRef<PIF_metrics>, PIF_metrics>();
private readonly ChangeableDictionary<XenRef<Pool>, Pool> _pool = new ChangeableDictionary<XenRef<Pool>, Pool>();
private readonly ChangeableDictionary<XenRef<PIF>, PIF> _pif = new ChangeableDictionary<XenRef<PIF>, PIF>();
private readonly ChangeableDictionary<XenRef<Pool_patch>, Pool_patch> _pool_patch = new ChangeableDictionary<XenRef<Pool_patch>, Pool_patch>();
private readonly ChangeableDictionary<XenRef<Pool_update>, Pool_update> _pool_update = new ChangeableDictionary<XenRef<Pool_update>, Pool_update>();
private readonly ChangeableDictionary<XenRef<Pool>, Pool> _pool = new ChangeableDictionary<XenRef<Pool>, Pool>();
private readonly ChangeableDictionary<XenRef<PUSB>, PUSB> _pusb = new ChangeableDictionary<XenRef<PUSB>, PUSB>();
private readonly ChangeableDictionary<XenRef<PVS_cache_storage>, PVS_cache_storage> _pvs_cache_storage = new ChangeableDictionary<XenRef<PVS_cache_storage>, PVS_cache_storage>();
private readonly ChangeableDictionary<XenRef<PVS_proxy>, PVS_proxy> _pvs_proxy = new ChangeableDictionary<XenRef<PVS_proxy>, PVS_proxy>();
private readonly ChangeableDictionary<XenRef<PVS_server>, PVS_server> _pvs_server = new ChangeableDictionary<XenRef<PVS_server>, PVS_server>();
private readonly ChangeableDictionary<XenRef<PVS_site>, PVS_site> _pvs_site = new ChangeableDictionary<XenRef<PVS_site>, PVS_site>();
private readonly ChangeableDictionary<XenRef<Repository>, Repository> _repositories = new ChangeableDictionary<XenRef<Repository>, Repository>();
private readonly ChangeableDictionary<XenRef<Role>, Role> _role = new ChangeableDictionary<XenRef<Role>, Role>();
private readonly ChangeableDictionary<XenRef<SM>, SM> _sm = new ChangeableDictionary<XenRef<SM>, SM>();
private readonly ChangeableDictionary<XenRef<SR>, SR> _sr = new ChangeableDictionary<XenRef<SR>, SR>();
private readonly ChangeableDictionary<XenRef<Subject>, Subject> _subject = new ChangeableDictionary<XenRef<Subject>, Subject>();
private readonly ChangeableDictionary<XenRef<Task>, Task> _task = new ChangeableDictionary<XenRef<Task>, Task>();
private readonly ChangeableDictionary<XenRef<Tunnel>, Tunnel> _tunnel = new ChangeableDictionary<XenRef<Tunnel>, Tunnel>();
private readonly ChangeableDictionary<XenRef<VBD>, VBD> _vbd = new ChangeableDictionary<XenRef<VBD>, VBD>();
private readonly ChangeableDictionary<XenRef<USB_group>, USB_group> _usb_group = new ChangeableDictionary<XenRef<USB_group>, USB_group>();
private readonly ChangeableDictionary<XenRef<VBD_metrics>, VBD_metrics> _vbd_metrics = new ChangeableDictionary<XenRef<VBD_metrics>, VBD_metrics>();
private readonly ChangeableDictionary<XenRef<VBD>, VBD> _vbd = new ChangeableDictionary<XenRef<VBD>, VBD>();
private readonly ChangeableDictionary<XenRef<VDI>, VDI> _vdi = new ChangeableDictionary<XenRef<VDI>, VDI>();
private readonly ChangeableDictionary<XenRef<VGPU>, VGPU> _vgpu = new ChangeableDictionary<XenRef<VGPU>, VGPU>();
private readonly ChangeableDictionary<XenRef<VGPU_type>, VGPU_type> _vgpu_types = new ChangeableDictionary<XenRef<VGPU_type>, VGPU_type>();
private readonly ChangeableDictionary<XenRef<VIF>, VIF> _vif = new ChangeableDictionary<XenRef<VIF>, VIF>();
private readonly ChangeableDictionary<XenRef<VGPU>, VGPU> _vgpu = new ChangeableDictionary<XenRef<VGPU>, VGPU>();
private readonly ChangeableDictionary<XenRef<VIF_metrics>, VIF_metrics> _vif_metrics = new ChangeableDictionary<XenRef<VIF_metrics>, VIF_metrics>();
private readonly ChangeableDictionary<XenRef<VIF>, VIF> _vif = new ChangeableDictionary<XenRef<VIF>, VIF>();
private readonly ChangeableDictionary<XenRef<VLAN>, VLAN> _vlan = new ChangeableDictionary<XenRef<VLAN>, VLAN>();
private readonly ChangeableDictionary<XenRef<VM>, VM> _vm = new ChangeableDictionary<XenRef<VM>, VM>();
private readonly ChangeableDictionary<XenRef<VM_metrics>, VM_metrics> _vm_metrics = new ChangeableDictionary<XenRef<VM_metrics>, VM_metrics>();
private readonly ChangeableDictionary<XenRef<VM_guest_metrics>, VM_guest_metrics> _vm_guest_metrics = new ChangeableDictionary<XenRef<VM_guest_metrics>, VM_guest_metrics>();
private readonly ChangeableDictionary<XenRef<VMSS>, VMSS> _vmss = new ChangeableDictionary<XenRef<VMSS>, VMSS>();
private readonly ChangeableDictionary<XenRef<VM_appliance>, VM_appliance> _vm_appliance = new ChangeableDictionary<XenRef<VM_appliance>, VM_appliance>();
private readonly ChangeableDictionary<XenRef<Crashdump>, Crashdump> _crashdump = new ChangeableDictionary<XenRef<Crashdump>, Crashdump>();
private readonly ChangeableDictionary<XenRef<Certificate>, Certificate> _certificates = new ChangeableDictionary<XenRef<Certificate>, Certificate>();
private readonly ChangeableDictionary<XenRef<VM_guest_metrics>, VM_guest_metrics> _vm_guest_metrics = new ChangeableDictionary<XenRef<VM_guest_metrics>, VM_guest_metrics>();
private readonly ChangeableDictionary<XenRef<VM_metrics>, VM_metrics> _vm_metrics = new ChangeableDictionary<XenRef<VM_metrics>, VM_metrics>();
private readonly ChangeableDictionary<XenRef<VM>, VM> _vm = new ChangeableDictionary<XenRef<VM>, VM>();
private readonly ChangeableDictionary<XenRef<VMSS>, VMSS> _vmss = new ChangeableDictionary<XenRef<VMSS>, VMSS>();
private readonly ChangeableDictionary<XenRef<VTPM>, VTPM> _vtpms = new ChangeableDictionary<XenRef<VTPM>, VTPM>();
private readonly ChangeableDictionary<XenRef<VUSB>, VUSB> _vusb = new ChangeableDictionary<XenRef<VUSB>, VUSB>();
#pragma warning restore 0414
private bool foldersChanged;
private bool dockerContainersChanged;
private readonly Dictionary<Type, IDictionary> dictionaries = new Dictionary<Type, IDictionary>();
public Cache()
@ -118,32 +121,30 @@ namespace XenAdmin.Network
}
}
public Certificate[] Certificates => contents(_certificates);
#region Properties
public Bond[] Bonds => contents(_bond);
public VMSS[] VMSSs => contents(_vmss);
public VM_appliance[] VM_appliances => contents(_vm_appliance);
public Certificate[] Certificates => contents(_certificates);
public Cluster[] Clusters => contents(_cluster);
public Cluster_host[] Cluster_hosts => contents(_cluster_host);
public DockerContainer[] DockerContainers => contents(_dockerContainers);
public Feature[] Features => contents(_feature);
public Folder[] Folders => contents(_folders);
public DockerContainer[] DockerContainers => contents(_dockerContainers);
public GPU_group[] GPU_groups => contents(_gpu_groups);
public Host[] Hosts => contents(_host);
public int HostCount => _host.Count;
public Host_cpu[] Host_cpus => contents(_host_cpu);
public int HostCount => _host.Count;
public Message[] Messages => contents(_message);
public XenAPI.Network[] Networks => contents(_network);
@ -152,12 +153,6 @@ namespace XenAdmin.Network
public PBD[] PBDs => contents(_pbd);
public PUSB[] PUSBs => contents(_pusb);
public VUSB[] VUSBs => contents(_vusb);
public USB_group[] USB_groups => contents(_usb_group);
public PCI[] PCIs => contents(_pcis);
public PGPU[] PGPUs => contents(_pgpu);
@ -170,13 +165,17 @@ namespace XenAdmin.Network
public Pool_update[] Pool_updates => contents(_pool_update);
public PVS_site[] PVS_sites => contents(_pvs_site);
public PUSB[] PUSBs => contents(_pusb);
public PVS_server[] PVS_servers => contents(_pvs_server);
public PVS_cache_storage[] PVS_cache_storages => contents(_pvs_cache_storage);
public PVS_proxy[] PVS_proxies => contents(_pvs_proxy);
public PVS_cache_storage[] PVS_cache_storages => contents(_pvs_cache_storage);
public PVS_server[] PVS_servers => contents(_pvs_server);
public PVS_site[] PVS_sites => contents(_pvs_site);
public Repository[] Repositories => contents(_repositories);
public Role[] Roles => contents(_role);
@ -188,6 +187,8 @@ namespace XenAdmin.Network
public Tunnel[] Tunnels => contents(_tunnel);
public USB_group[] USB_groups => contents(_usb_group);
public VBD[] VBDs => contents(_vbd);
public VDI[] VDIs => contents(_vdi);
@ -200,8 +201,15 @@ namespace XenAdmin.Network
public VM[] VMs => contents(_vm);
public VM_appliance[] VM_appliances => contents(_vm_appliance);
public VMSS[] VMSSs => contents(_vmss);
public VTPM[] VTPMs => contents(_vtpms);
public VUSB[] VUSBs => contents(_vusb);
#endregion
private static T[] contents<T>(ChangeableDictionary<XenRef<T>, T> d) where T : XenObject<T>
{
@ -283,6 +291,7 @@ namespace XenAdmin.Network
}
private static MethodInfo ClearMethod = typeof(Cache).GetMethod("Clear_", BindingFlags.NonPublic | BindingFlags.Instance);
public void Clear()
{
foreach (IDictionary d in dictionaries.Values)
@ -496,7 +505,6 @@ namespace XenAdmin.Network
return d.GetType().GetGenericArguments()[1];
}
private bool foldersChanged = false;
public void AddFolder(XenRef<Folder> path, Folder folder)
{
_folders[path] = folder;
@ -530,7 +538,6 @@ namespace XenAdmin.Network
}
}
private bool dockerContainersChanged = false;
public void UpdateDockerContainersForVM(IList<DockerContainer> containers, VM vm)
{
Trace.Assert(vm != null);

View File

@ -46,21 +46,22 @@ namespace XenAdmin.Network
Feature[] Features { get; }
Folder[] Folders { get; }
GPU_group[] GPU_groups { get; }
Host_cpu[] Host_cpus { get; }
Host[] Hosts { get; }
Host_cpu[] Host_cpus { get; }
Message[] Messages { get; }
XenAPI.Network[] Networks { get; }
PBD[] PBDs { get; }
PCI[] PCIs { get; }
PGPU[] PGPUs { get; }
PIF[] PIFs { get; }
Pool[] Pools { get; }
Pool_patch[] Pool_patches { get; }
Pool_update[] Pool_updates { get; }
Pool[] Pools { get; }
PVS_site[] PVS_sites { get; }
PVS_server[] PVS_servers { get; }
PVS_proxy[] PVS_proxies { get; }
PVS_cache_storage[] PVS_cache_storages { get; }
PVS_proxy[] PVS_proxies { get; }
PVS_server[] PVS_servers { get; }
PVS_site[] PVS_sites { get; }
Repository[] Repositories { get; }
Role[] Roles { get; }
SM[] SMs { get; }
SR[] SRs { get; }