Storage Provider

API

using NTFX.Api;
// assume namespace and class

public static void Execute(AppContext _context)
{
   var RootBucket = _context.Storage.RequestBucket("/");
   var UsersBucket = _context.Storage.RequestBucket("/users");
   var OtherStuff = _context.Storage.RequestBucket("/otherstuff");
   
   var NamesBucket = _context.Storage.CreateBucket("/names");
   
   
   RootBucket.Get("SomeChildValue").Set("Another Value");
   UsersBucket.Where((user) => user.Name.Contains("ntfx")).Delete();
}

Buckets

Buckets are simply containered parts of the larger Storage System. Buckets ensure each application has its own part of the storage isolated from each other.

If required applications can request access to the global bucket, ntfx bucket, and even the subsystem buckets.

var GlobalBucket = await _context.Storage.RequestGlobalBucket();
var NTFXBucket = await _context.Storage.RequestNTFXBucket(); // Requires admin
var SubsystemBucket = await _context.Storage.RequestSubsystemBucket(); // Requires root

Accessing another apps bucket

Application buckets are isolated until the user or the application allows another application access

For an application to allow another application access, it must be subscribed to the OnApplicationRequestApplicationBucket event.

In application to application requests, the application that owns the bucket should have a handler similar to the example shown below:

application.cs
MyApp.Events.OnApplicationRequestApplicationBucket += (req,res) => {
  if (req.Application.FullName.Tolower() == "sytem info")
  {
    return res.AllowAccess();
  }
};

For user to application requests, the user can simply elevate to admin to view all the buckets.

Making a bucket permanently public

#admin#
sytem buckets make-public "mysamplebucket" --force --persist

Last updated