Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the BTree to the disk #8

Open
abdullahemad12 opened this issue Jun 28, 2018 · 0 comments
Open

Store the BTree to the disk #8

abdullahemad12 opened this issue Jun 28, 2018 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@abdullahemad12
Copy link
Owner

Task

Store the B-tree to a binary file on the hard disk with its corresponding objects if necessary.

Binary file format:

Header:

bits 0 - 7: identifier (magic number)
bits 8-39: length
bits 40 - 71: max_key
bits 72 - 103: min_key
bits 104-135: n

File Format and algorithm:

  • 8 bits: node identifier (just a number to identify that we are reading a node)
  • 32 bits: len
  • store n entries:
    for each entry store the key and call a function given by the user on the object pointer to store it.
    Note: reserve 32 bits for the size of the object before calling the message and calculate the seek to get the size of the object.

repeat this for all the children of the node

@abdullahemad12 abdullahemad12 added enhancement New feature or request help wanted Extra attention is needed labels Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant