Closed benny-adiwijaya closed 3 years ago
Hi @benny-adiwijaya , can you wait for the new major version 1.2.0. I'm going to introduce Plugin concept which uses AOP and Proxy to extend the library flawlessly. Plugins can deal with many cross-cutting concerns such as: logging, validating, filtering... It may takes 2-3 days more to get the work done. ;)
Great, I'm looking forward to it :)
Hi @benny-adiwijaya, a new major version was just released ;) Check it out.
Hi @trannamtrung1st, your work is amazing! big thanks
In the AdvancedDemo, some command are dissapear like copy, duplicate, resize & rotate, and create archive. How to show up those commands?
Hi @benny-adiwijaya, the Quota management plugin currently supports some commands only. See the QuotaOptions class for more details. archive, duplicate, extract, put, resize: can cause an increase in storage usage. However, it is difficult to track every item created in these commands (whether they are overwritten or completely new --> the size will be different). For the archive cmd, we only know the zip file size after being written to the disk. I plan to enable it later, maybe using a better approach like Events since writing a Plugin (interceptor) is quite complicated. Do you have any idea? Feel free to share with me. I update this both for personal use and with my passion ;)
Oke, I will try to find the solution.. btw, is quota management can be use for multiple volume with specific quota for each volume?
@benny-adiwijaya yes it is. See FilesController for how to set up a quota for each volume.
Hi @trannamtrung1st , I already tried using multiple volume, but the quota management only work for the last setup volume
Here is my code `private async Task SetupConnectorAsync(CancellationToken cancellationToken){ cancellationToken.ThrowIfCancellationRequested(); foreach(var item in new string[] { "mrdavid", "msdiana" }) { var volume = new Volume(_driver, Startup.MapPath($"~/upload/{item}"), $"/upload/{item}/", $"/api/files/thumb/") { Name = item, ThumbnailDirectory = PathHelper.GetFullPath($"./thumb/{item}") }; await _driver.SetupVolumeAsync(volume, cancellationToken); _connector.AddVolume(volume); _driver.AddVolume(volume);
var quotaOptions = new QuotaOptions() { Enabled = true };
quotaOptions.Quotas[volume.VolumeId] = new VolumeQuota
{
VolumeId = volume.VolumeId,
MaxStorageSizeInMb = 60
};
_connector.PluginManager.Features[typeof(QuotaOptions)] = quotaOptions;
#endregion
}
}`
In this code, the quota management only work for msdiana's volume, is there something wrong?
Hi @trannamtrung1st , I already tried using multiple volume, but the quota management only work for the last setup volume
Here is my code
private async Task SetupConnectorAsync(CancellationToken cancellationToken){ cancellationToken.ThrowIfCancellationRequested(); foreach(var item in new string[] { "mrdavid", "msdiana" }) { var volume = new Volume(_driver, Startup.MapPath($"~/upload/{item}"), $"/upload/{item}/", $"/api/files/thumb/") { Name = item, ThumbnailDirectory = PathHelper.GetFullPath($"./thumb/{item}") }; await _driver.SetupVolumeAsync(volume, cancellationToken); _connector.AddVolume(volume); _driver.AddVolume(volume); #region Quota management var quotaOptions = new QuotaOptions() { Enabled = true }; quotaOptions.Quotas[volume.VolumeId] = new VolumeQuota { VolumeId = volume.VolumeId, MaxStorageSizeInMb = 60 }; _connector.PluginManager.Features[typeof(QuotaOptions)] = quotaOptions; #endregion } }
In this code, the quota management only work for msdiana's volume, is there something wrong?
It seems the demo code is a little bit confusing. You should put the var quotaOptions = ...;
and _connector.PluginManager.Features[typeof(QuotaOptions)] = quotaOptions;
out of the for loop.
Hi @benny-adiwijaya , I just dropped a new version 1.2.1 with:
I will close this issue. Feel free to open another if any problem arises.
Hi,
Is it possible to save files/folders in FileSystem driver normally and at the same time use database to save files/folders information?
Right now I'm using conResult.Response in the FilesController to store the data to database, but I have difficult time with rename and cut folder because conResult.Response does not grab information files/subfolders inside the folder. So, is there a better ways to store data to the database? Thank you