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:
parent
48c2011500
commit
fa7fbfd0ac
1 changed files with 17 additions and 0 deletions
|
@ -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.");
|
||||
|
|
Loading…
Reference in a new issue