1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Allow RippleSpaceManagers to create new planes.

This commit is contained in:
Starbeamrainbowlabs 2017-04-16 15:24:37 +01:00
parent 48c2011500
commit fa7fbfd0ac

View file

@ -22,6 +22,8 @@ namespace Nibriboard.RippleSpace
/// </summary>
public long LastMaintenanceDuration = 0;
public int DefaultChunkSize { get; set; } = 512;
public RippleSpaceManager()
{
Log.WriteLine("[RippleSpace] New blank ripplespace initialised.");
@ -53,6 +55,21 @@ namespace Nibriboard.RippleSpace
return null;
}
/// <summary>
/// Creates a new plane, adds it to this RippleSpaceManager, and then returns it.
/// </summary>
/// <param name="newPlaneName">The name of the new plane to create.</param>
/// <returns>The newly created plane.</returns>
protected Plane CreatePlane(string newPlaneName)
{
if(this[newPlaneName] != null)
throw new InvalidOperationException($"Error: A plane with the name '{newPlaneName}' already exists in this RippleSpaceManager.");
Plane newPlane = new Plane(newPlaneName, DefaultChunkSize);
Planes.Add(newPlane);
return newPlane;
}
public async Task StartMaintenanceMonkey()
{
Log.WriteLine("[RippleSpace/Maintenance] Automated maintenance monkey created.");