A simple key-value store database implemented in Go.
This project implements a basic key-value store using a B-tree for indexing. It utilizes memory mapping for efficient disk access and supports basic operations like Get, Set, and Delete and 'update'.
- B-tree indexing: Efficiently stores and retrieves key-value pairs.
- Memory mapping: Uses
mmapfor fast disk access. - Basic operations: Supports
Get,Set, andDeleteoperations. - Page management: Implements page allocation, deallocation, and persistence.
- Master page: Stores metadata like the root of the B-tree and used page count.
.
├── Code
│ ├── BTreeImplement
│ │ ├── BTree.go # Main B-Tree structure
│ │ ├── Commons.go # Common utilities for B-Tree
│ │ ├── Delete.go # Deletion functionality for B-Tree
│ │ ├── Get.go # Retrieval functionality for B-Tree
│ │ └── Insert.go # Insert functionality for B-Tree
│ ├── KVStoreImplement
│ │ ├── KVStore.go # Key-Value store implementation
│ │ ├── KVUtils.go # Utility functions for Key-Value store
│ │ └── Master.go # Master control for Key-Value operations
│ └── Utils
│ └── Utils.go # General utility functions
├── go.mod # Golang module information
├── go.sum # Dependency file
├── main.go # Main entry point of the application
├── oldmain # Archive of older code
└── Sqlite.db # Sample SQLite database
- Golang: Make sure Golang is installed on your machine (version 1.17 or higher).
- Git: Clone this repository.
- Clone the repository:
git clone https://github.com/yourusername/custom-sqlite-query-processor.git
- Navigate to the project directory:
cd custom-sqlite-query-processor - Install the dependencies:
go mod tidy
- Run the project:
go run main.go
- The B-Tree structure provides fast and efficient insert, delete, and search operations.
- The Key-Value store enables users to store and retrieve data in a key-value pair format.
- The backend is optimized to handle large datasets and complex queries.
// Inserting a key-value pair into the B-Tree
Insert(key, value)
// Retrieving a value by key
Get(key)
// Deleting a key-value pair
Delete(key)
// Getall function to retrieve all key-value pairs
GetAll()- Encapsulation: Structs like
BTNodeencapsulate the data of B-tree nodes. - Abstraction: B-tree and key-value store operations abstract the underlying data handling mechanisms.
- Composition: Go uses composition to reuse struct functionality instead of traditional inheritance.
- Polymorphism: Implemented through interfaces to allow different data structures to use the same operations.
