Admin or non-Admin

For BangDB Server, user may wish to run the program as admin or non Admin. With 0.9 version the server gives all control to the user programmatically. The command tool is not necessary to do admin level jobs for ex; create database, table etc. However user should be careful not to do admin level job when it's not required. For example closing of table or db by non admin

In the current version (0.9), the admin and non admin rights are not separated and just the use of right set of constants make the difference. In future release, the user based admin rights would be enforced. Right now all users are by default admin

Here are the list of constants (enums) which can make all difference;

	
 enum bangdb_open_type
 {
	OPENCREATE,
	TRUNCOPEN,
	JUSTOPEN
 };
	

When opening a resource ex; database or table, admin should use OPENCREATE which will open the resource if existing else create it at the server. For non-admins, use JUSTOPEN.

The APIs where the bangdb_open_type is used are; (all exposed by database class)

  • gettable();
  • getWideTable();
  • getPrimitiveTable();
	
 enum bangdb_close_type
 {
	DEFAULT_AT_CLIENT,
	CONSERVATIVE_AT_SERVER,
	OPTIMISTIC_AT_SERVER,
	CLEANCLOSE_AT_SERVER,
	SIMPLECLOSE_AT_SERVER,
	DEFAULT_AT_SERVER,
 };
	

Non admin should always use DEFAULT_AT_CLIENT which means just close the resources (ex; db, table) at the client only and not at the server level. However admin may use which ever they wish as all other close type values applies at server

The APIs where the bangdb_close_type is used are;

  • closetable(); //exposed by database and table class
  • closedatabase(); //exposed by database
  • close(); //for swTable and TopK

As you notice the admin vs non-admin difference is only at the level of create or close database and tables.

It's very important that the rules defined above are followed strictly otherwise a non-admin user might close a resource which will make it unavailable for all other users or a non-admin might create some resource which should not be created

In nutshell follow these;

Non-Admin - user JUSTOPEN for bangdb_open_type and DEFAULT_AT_CLIENT for bangdb_close_type always

Admin - may use which ever is fit