DEV Community

Akira Shimodate
Akira Shimodate

Posted on

Introducing VirtualStorageLibrary: A .NET Solution for In-Memory Tree Structures

burner.png

repository: https://github.com/shimodateakira/VirtualStorageLibrary

Hello Dev.to,

I'm excited to share a project I've been working on called VirtualStorageLibrary.
It's a .NET library designed to manage in-memory tree structures, including items, directories, and symbolic links.

Here's an introduction to the library:

Project Overview and Purpose:

VirtualStorageLibrary is a .NET library that operates entirely in-memory and
provides a tree-structured collection. This library offers a foundation
for managing hierarchical data structures, supporting items, directories,
and symbolic links that encapsulate user-defined types (generic types defined by the user).

This library is not a file system.

Instead, it was redesigned from scratch to create a more
flexible and user-friendly tree structure. The library aims to make it
intuitive to reference, traverse, and manipulate nodes by specifying
paths.

Project Background:

The collections provided by .NET are linear, including types like hash sets,
arrays, lists, and dictionaries, which inherently have a linear structure (such as arrays and lists).
In contrast, common file systems can be viewed as tree-shaped collections, where
elements are managed as nodes in a hierarchical structure. While there are
existing libraries that support tree-shaped collections, I couldn’t find one
that models a file system-like structure. Therefore, I conceptualized a
logical interpretation of a file system and asked, "Can we implement a tree
collection purely as objects?" The goal was to create a system that can
flexibly manage hierarchical and allow intuitive access.

Key Features:

  • Flexible Tree Structure
    Hierarchical structure based on parent-child
    relationships, enabling flexible node management.

  • Various Nodes
    Items, directories, and symbolic links, including
    user-defined types .

  • Intuitive Node Operations via Paths
    API for referencing, searching, adding,
    deleting, renaming, copying, and moving nodes using paths.

  • Link Management
    Symbolic links managed with a link dictionary, tracking
    changes in target paths.

  • Circular Reference Prevention
    Detects and prevents circular references in paths involving
    symbolic links by throwing an exception.

  • Flexible Node List Retrieval
    Retrieves node lists within directories, filtered, grouped, and
    sorted by specified node types and attributes.

Anticipated Use Cases:

  • Natural Language Processing (NLP)
  • Knowledge Base Systems
  • Game Development
  • Hierarchical Clustering
  • Education and Learning

Development Status and Future Plans:

The current version is 0.8.0 (prerelease).
As of 2024/08, all essential features for version 1.0.0 have been implemented.

However, some bug fixes, around 30 feature improvements, and refactoring tasks remain.

With version 0.8.0, we aim to gather user feedback, including bug reports and feature enhancement suggestions.

Simultaneously, we plan to work through the remaining tasks for version 0.9.0, targeted for release in October 2024.

During this period, class names, method names, property names, and other elements in the library may change, merge, or be deprecated without notice.

Detailed information will be provided in the release notes, so please check them for updates.

For more detailed information on the current issues and planned improvements, please visit the following page (content in Japanese):

https://github.com/users/shimodateakira/projects/3/views/3

Thank you for your interest, and I look forward to your feedback.

VirtualStorageLibraryLogo

Top comments (4)

Collapse
 
shimodateakira profile image
Akira Shimodate

Version 0.9.1 - Prerelease

This is the prerelease of the project, focusing on bug fixes, enhancements, and new features.

New Features

Adapter for Items and Symbolic Links in Indexer (#189)

We've added new adapters for items and symbolic links to improve the indexing capabilities of the VirtualStorage class. This allows for more intuitive access and manipulation of items and symbolic links within the storage.

Added Classes

VirtualItemAdapter<T>
VirtualSymbolicLinkAdapter<T>

These adapters provide a streamlined way to interact with items and symbolic links in the storage, enhancing usability and functionality.

Example Usage

Below is an example demonstrating the new adapters in action

VirtualStorage<int> vs = new();

vs["/"] += new VirtualDirectory("dir1");
vs["/dir1"] += new VirtualItem<int>("item1", 123);
vs["/"] += new VirtualSymbolicLink("link1", "/dir1/item1");

Console.WriteLine($"item1 ItemData = {vs.Item["/dir1/item1"].ItemData}");
Console.WriteLine($"link1 TargetPath = {vs.Link["/link1"].TargetPath}");
Console.WriteLine($"link1 ItemData = {vs.Item["/link1"].ItemData}");
Enter fullscreen mode Exit fullscreen mode

Output

item1 ItemData = 123
link1 TargetPath = /dir1/item1
link1 ItemData = 123
Enter fullscreen mode Exit fullscreen mode
Collapse
 
shimodateakira profile image
Akira Shimodate • Edited

VirtualStorageLibrary 0.9.0 – Bug Fixes and Enhancements for .NET Tree Structures

Hello Dev.to, I'm excited to share the latest update of my project, VirtualStorageLibrary. This .NET library is designed to manage in-memory tree structures, including items, directories, and symbolic links. In this 0.9.0 release, we've focused on important bug fixes and enhancements to improve the library's robustness and usability.

What's Improved in Version 0.9.0:

  • #56: Implemented validity checks for target node names during link creation.
  • #69: Renamed the GetNodesWithPath method to GetPaths.
  • #86: Updated AddLinkToDictionary to pass absolute paths for target paths.
  • #144: Fixed an issue in the RemoveNode method that allowed deletion of the current path; now throws an exception instead.
  • #145: Added validation checks to prevent incorrectly specified regular expressions.
  • #146: Introduced a new exception for when a path is not found.
  • #147: Added a mechanism to dynamically switch wildcard matchers, improving pattern matching flexibility.
  • #148: Improved the organization of DebuggerStepThrough attributes across the codebase for a better debugging experience.
  • #158: Fixed a bug during initialization in the VirtualPath class.
  • #184: Resolved an exception that occurred when copying items under a symbolic link in the CopyNode method.

These updates aim to provide a more robust and flexible solution for managing hierarchical data structures in .NET environments.

For a detailed list of all changes, please see the release notes: shimodateakira.github.io/VirtualSt...

Thank you for your continued interest and feedback. I'm looking forward to hearing your thoughts on this release!

  • Akira Shimodate, AkiraNetwork
Collapse
 
shimodateakira profile image
Akira Shimodate

Support VirtualStorageLibrary: Sponsorship Now Open!

Hello, I'm Akira. AkiraNetwork is now live on GitHub Sponsors, seeking support for the development of VirtualStorageLibrary! Your sponsorship will greatly help us continue growing the project and developing new features.
Check out more details here: GitHub Sponsors

Collapse
 
shimodateakira profile image
Akira Shimodate

Release 0.9.0.3 - Prerelease

This is the prerelease of the project, focusing on bug fixes and enhancements.

Issue:

#188 When updating symbolic links, the link dictionary was not being updated.