Skip to content

Releases: QSmally/QDB

4.0.0-beta.6

21 Nov 12:34
Compare
Choose a tag to compare
4.0.0-beta.6 Pre-release
Pre-release

This release drafts the sixth beta version of QDB4.

Yet another beta release of the QDB module. I've implemented and improved a lot of things since the last version. As predicted in the previous beta version, there have been major changes in terms of efficiency and structural formatting of the database.

Fixes

  • Prevent DataStore property being stored. (7c489f9)
  • Fix cached object model having an incorrect cast. (add1408)

Selection

Secondly, Selections have gotten a fairly big usage improvement since the previous prerelease of QDB. There are a lot of new methods and performance improvements included in this version, such as:

  • <Selection>.Group(Key: String) -> Selection
    • Based on a SQL GROUP BY statement.
    • Groups this Selection into categories specified by the value of the Key attribute per each entry.
  • <Selection>.Map(Fn<Val, Key, i>: Function) -> Selection
    • Identical to Array.prototype.map.
    • Maps each entry with the value returned from the callback function.
  • <Selection>.Clone(Holds?: String) -> Selection
    • Creates an identical, deep copy of this Selection instance.
  • <Selection>.Join(Secondary: Selection, Field: String, Property?: Boolean|String) -> Selection
    • Based on a SQL FULL JOIN statement.
    • Groups entries in a dictionary named after Property that have matching keys as specified by the Field parameter.
    • The Property parameter can either be a direct name, a boolean true to use the Selection's hold property, or false to flatten the values into the Selection's entry.
  • <Selection>.Merge(...Selections: Selection) -> Selection
    • Inserts the entries of the secondary Selections into this Selection instance.

Database Iteration

As for the Each(), Find() and Select() methods, I have implemented a few changes that improve the performance of those instructions by a fair bit. These improvements are achieved by fetching the entire database instead of rows one-by-one, which I should've done in the first place. For the find function, there's now an optimisation where it iterates through the cache before touching the database itself, which results in partial faster retrieval of the outcome.

Internal Thread Deprecation

Lastly, I decided to deprecate the implementation of internal Pool threads. I'm convinced that it would be far more useful if you created your own implementation of multiple threads or processes. It would be far more performant, together with the fact that it's far more controllable than an internal solution.

Miscellaneous

  • Rebased folder structure for Executors. (#22)
  • Deprecated internal Pool threads. (#23)
  • Clearer Schema modelling unit. (#24)
  • Rename Schema migration method to Instance().
  • Implemented a better Ensure() method with Schema merge.

4.0.0-beta.5

25 Oct 15:38
Compare
Choose a tag to compare
4.0.0-beta.5 Pre-release
Pre-release

This release drafts the fifth beta version of QDB4.

I decided to extend the beta lifetime of QDB, as I'm not entirely sure of the structure and features of this module. As such, there could be a few major changes coming in the next release(s).

Fixes

  • Documentation type fixes.
  • Transaction activity check before committing/rolling back. (0292a77)

CacheMaxSize

Secondly, there's a new option added to the Connection options. A CacheMaxSize integer (or false), which currently only has the eviction strategy to stop adding new entries to the cache until space has freed up. I found that this is the most performant out of everything I benchmarked, and is currently the only eviction strategy implemented.

Threaded Pools

Finally, I have made internal changes to the threaded Pool. These changes aren't that visible, but now the methods on the Gateway class are automatically attached from the Connection class.

As for the future of threaded Pools, I'm also not quite sure if they're going to be any useful. I might drop the support for threaded Pools as implementing your own would be more performant anyways. Additionally, threaded Pools remove the possibility to attach functions to your queries, and those queries are mostly always the slowest - which defeats the purpose of the thread.

4.0.0-beta.4

29 Sep 18:00
Compare
Choose a tag to compare
4.0.0-beta.4 Pre-release
Pre-release

This release drafts the fourth beta version of QDB4.

This version implements a few bug fixes to various parts of the module. Including, but not limited to:

  • Documentation type fixes.
  • 'Not a database' error when iterating through files.
  • 'Null' error when a path was casted in Connection fetch mode.

Secondly, I added or tweaked a couple of features within the package.

  • There's a new method added to the Pool class to disconnect from the Connections, <Pool>.Disconnect() -> Pool.
  • The Erase() method of Connections has been improved, as now it uses one SQL instructions instead of chaining multiple.
  • Pools can now be backed up as a general endpoint for managing copies of the databases.
  • As for performance improvements, there's a new IterCache option to customise iteration behaviour of the database.

Finally, I implemented a way for Pools to be run on a separate thread. As to instantiate a Pool with a thread, add the Threaded option and give it a true value to indicate that you want to initialise a worker thread for this Pool. This option will initialise Gateways instead of Connections, and these class instances will communicate with the Pool's ThreadProvider to send instructions and receive data from the worker thread.

It's currently not possible to create multiple threads, but I would consider it in later releases.

4.0.0-beta.3

14 Sep 16:07
Compare
Choose a tag to compare
4.0.0-beta.3 Pre-release
Pre-release

This release drafts the third beta version of QDB4.

This version implements a few minor bug fixes to multiple parts of the database, applied more internal consistency and added a few new features. The database side of QDB4 is fully functional and usable, and we'll be heading close to the main release of this package.

  • There's now a Serialise getter that you can call, instead of using the raw Serialiser property of the Schema class.
    • This allows you to do <Schema>.Serialise(...Properties: Any) and will always return a function.
  • The Find() method has been improved, as now it does not pre-cache all the data which it'll iterate through.
  • As memory improvement, the Each() method now uses the Indexes property and does not pre-cache the data.
  • Select() now also accepts keys (or paths), to - for example - select an object of entries of a row.
  • Internal changes related to the path caster.

Lastly, I have implemented the base version of Pools.

  • Instantiate a Pool with new QDB.Pool(PathURL: Pathlike, PoolOptions: PoolOptions?) -> Pool.
  • As per the PathURL, you can direct it to a directory of databases or one file. Both will initialise a Connection to all the tables in the file(s).
  • Select a Connection using <Pool>.$(Base: DatabaseIdentifier) with the argument being either the file name or table of the Connection.

Backups of entire Pools are not possible quite yet. Individual backups are disabled in favour of mass-backups. Either externally backup the database(s), or wait until the next release when I have implemented them.

Finally, in future releases, I'm going to implement Pool multithreading for database efficiency. The Pool selection method already takes into account whether it's a ThreadProvider or a standard Connection, but it would always return a Connection (or an undefined value) in this beta release.

4.0.0-beta.2

03 Sep 10:18
Compare
Choose a tag to compare
4.0.0-beta.2 Pre-release
Pre-release

This release drafts a new beta version of QDB4.

This package is fully usable, but it lacks just a few minor things which I'll be implementing in the next few releases of v4.

In this release, there have been a few fixes regarding documentation and bugs. Additionally, I added tests for the Transaction wrapper class and also implemented the database backup executor.

Lastly, I changed the Select method and implemented the Selection class;

  • Select (basically filter out) rows in the database using <Connection>.Select(Fn<Entry, Idx>: Function) -> Selection.
  • From there, there's an in-memory copy of the rows you selected. Use the Sort, Filter and Limit methods to utilise the Selection.
    • <Selection>.Sort(Fn<av, bv, ak, bk>: Function) -> Selection
    • <Selection>.Filter(Fn<Val, Key>: Function) -> Selection
    • <Selection>.Limit(Begin: Number, End?: Number) -> Selection
  • When you manipulated the Selection, you can export it to an object or array: <Selection>.AsObject() or <Selection>.Values() as a value array.

4.0.0-beta.1

29 Aug 09:18
Compare
Choose a tag to compare
4.0.0-beta.1 Pre-release
Pre-release

This release drafts the first version of QDB4 in beta!

There were a few little fixes in this release regarding documentation, internal changes and the FetchAll Executor.

This release also implements one large addition: Schemas.

  • Create a database Schema Model with new QDB.Schema(Id: String, Model: Object|Array, Serialiser?: Function) -> Schema.
  • Access Schemas by storing the instance in a variable, or using QDB.Model(Id: String) -> Schema to retrieve it.
  • Bind a Model to a Connection using the Schema attribute in the Connection options: new QDB.Connection(Path: Pathlike, {Schema: QDB.Model(Id: String)}) -> Connection|PartialConnection.
  • When you start your application, include the -m or --migrate command line attribute to indicate the Schema Model has changed and it will convert all the entries in the database with the new model on initialisation.

With Schemas, you can also implement Serialisers. There wasn't much work done, as it's just a function variable, but it allows the possibility to create complex DataModels on request. Say you have a public method that converts a User entry into some API-driven context:

function FetchUser(Id) {
  const User = MyDB.Fetch(Id);
  if (!User) return undefined;
  return MyDB.Model("User").Serialiser(User);
}

4.0.0-alpha.5

25 Aug 16:32
Compare
Choose a tag to compare
4.0.0-alpha.5 Pre-release
Pre-release

This release drafts the final alpha version of QDB4.

This release implements a few breaking fixes, especially for the Modify and Invert methods. Array-methods, such as Push, now also accept multiple inputs - and they're inserted in the order of input.

Furthermore, there have been a few new functions added to the Connection setup:

  • <Connection>.Each(Fn<Entry, Idx>: Function, Evict?: Boolean) -> Connection
    • MyDB.Each((Entry, Idx) => { ... });
    • Iterates through the entire database. When Evict is enabled, it clears the cache afterwards due to the increase of memory usage.
  • <Connection>.Select(Fn<Entry, Idx>: Function) -> Object
    • MyDB.Select((Entry, Idx) => <Condition with Entry and Idx>);
    • Filters out rows in this database, and returns it as an object. This might change in the future to a Collection (or DataStore). Method also immediately flushes the cache of the newly fetched entries.
  • <Connection>.Shift(KeyOrPath: Pathlike, ...Values: [Any]?) -> Any|Number
    • const NewOrder = MyDB.Shift("1234.Orders");
    • MyDB.Shift("1234.Orders", Order1, Order2);
    • Shifts the pointed array, or unshifts it and inserts a value at the front when there are values in the input. Returns the shifted item, or the new length of the array when you inserted items.

Lastly, I've implemented wrapper support for Transactions.

  • Start a transaction in the current Connection with const Transaction = <Connection>.Transaction();;
  • Change something with the database synchronously;
  • Either implement your changes with Transaction.Commit();, or if there was an error with your data or the database, Transaction.Rollback();.

4.0.0-alpha.4

18 Aug 18:49
Compare
Choose a tag to compare
4.0.0-alpha.4 Pre-release
Pre-release

This release drafts a new alpha version of QDB4.

This package is usable, but it lacks a few features, like backups and schemas. Although this package is almost ready for beta stages, there might be a few bugs here and there, and there are more features to come and go.

The package in its current state implements a few bug fixes, adds a few methods like Ensure, Modify and Invert, and also implements Array methods for pushing, popping and removing individual values. Other functions are on their way and all methods are subject to change.

As stated in the previous prerelease, Events are from now on removed as standard for QDB4. If you'd still like to create events, which is useful in some cases, extend the class and create an EventHandler to emit functions in extended methods.

4.0.0-alpha.3

14 Aug 11:25
Compare
Choose a tag to compare
4.0.0-alpha.3 Pre-release
Pre-release

This release drafts a new alpha version of QDB4.

This package is usable, but it lacks some features, like backups, schemas and some utility methods. Although this package is almost ready for beta stages, there might be a few bugs here and there, and there are more features to come and go.

The package in its current state has reworked features, implements cache sweeping and utility methods such as Exist, Find and Accumulate (all methods are subject to change). As stated before, this release allows you to use it for early stages and testing!

Please do not depend on Events, as I'm removing this feature in the next or future releases of v4. If you'd still like to create events, which is useful in some cases, extend the class and create an EventHandler to emit functions in extended methods. It takes up processing space for 90% of packages that do not use this feature, and therefore I decided that I will remove it in the next base release.

4.0.0-alpha.2

11 Aug 19:28
Compare
Choose a tag to compare
4.0.0-alpha.2 Pre-release
Pre-release

This release drafts a new alpha version of QDB4.

This package is usable, but it lacks most features, like backups, cache sweeping, utility methods, etc. Please do not use this for production projects, or things that require very large databases. Cache sweeping is in this release not implemented, yet.

The package in its current state has reworked features, a new Connection setup and implements Executors and Events. As stated before, this release isn't ready for production yet, but it's enough for early stages and testing. This version also releases the basepoint of v4 and it will bring the features I am planning to implement.