comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Questions concerning "Simple Components"
Date: Wed, 4 Nov 2015 10:09:33 +0100
Date: 2015-11-04T10:09:33+01:00	[thread overview]
Message-ID: <1v465ejy695lo$.47114uuwfga6$.dlg@40tude.net> (raw)
In-Reply-To: 59c99dce-9cc6-4aba-9c5e-a5dd22ef7fea@googlegroups.com

On Tue, 3 Nov 2015 18:16:07 -0800 (PST), Jeremiah wrote:

> Generic_B_Trees have a generic package parameter "Width" which has the
> following description from the website:
> "Width is the size of the bucket of key-value pairs allocated per tree node;"
> 
> This doesn't make a lot of sense to me.  I'm sure I am just missing
> something simple, but what is the "bucket" being referenced?  Is it
> terminology for how many key value pairs can be created before more memory
> has to be allocated?

Yes

> The "per tree node" part also throws me off a little
> bit because on a binary tree, I would expect only one key/value pair per
> node.

Yes, in a logical view the container consists of key/value pairs. The
physical view of it is a hierarchy of buckets having fixed size.

> That said, I could be misunderstanding some of the terminology. 
> Can anyone add some clarity to what exactly the Width parameter does?

Width is the number of pairs in the bucket. Depending on the tree
(definite/indefinite) a bucket contains either the pairs as-is or
references to the pairs allocated elsewhere. The persistent B-tree buckets
have the size to fit into one block for optimal I/O.

> I really like the concept of Generic_External_B_Tree which use persistent
> storage to save data.  One thing I am trying to get a better handle on is
> a better way to handle the Root node address returned from
> Get_Root_Address.  I need this value to create the tree in a later
> application invocation.  I know I could just save it in another file or
> possibly add a root address value to all my tree nodes, but both of those
> methods seem wasteful.  What methods do yall use to store the root node
> address?

The persistent memory pool the tree resides in has a root index reserved in
particular for this purpose. The tree root address can be kept there. See:
Get_Root_Index, Set_Root_Index.

http://www.dmitry-kazakov.de/ada/components.htm#Persistent.Memory_Pools.Set_Root_Index

There are 16 independent values you can store there. Note that the root
address may change on tree update. After you have updated the tree before
committing the pool, get the root address and store it into one of the root
index values.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2015-11-04  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  2:16 Questions concerning "Simple Components" Jeremiah
2015-11-04  8:33 ` Niklas Holsti
2015-11-04  9:09 ` Dmitry A. Kazakov [this message]
2015-11-04 12:39   ` Jeremiah
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox