comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Truncating Direct IO files
Date: Tue, 21 Apr 2015 11:17:20 +0200
Date: 2015-04-21T11:17:20+02:00	[thread overview]
Message-ID: <m46ortphj54n$.hgqjs1dufrr1$.dlg@40tude.net> (raw)
In-Reply-To: 95d6f315-d21b-4106-961c-dcf11f8c04ad@googlegroups.com

On Tue, 21 Apr 2015 01:20:55 -0700 (PDT), tonyg wrote:

> I use your tables package in nearly everything I do!

I ma glad to hear that.

> I've been reading up
> on oop and tagged types and I'm going to bite the bullet and make another
> attempt at using your persistant storage. 

These are different things.

1. There is an implementation of persistent objects that supports
serialization and deserialization. The object may refer to other objects.
The objects are reference counted and when the last reference disappears
the object, if updated, gets serialized.

This persistence layer can be backed by anything. E.g. a database or by a
direct file I/O with some infrastructure sitting on top of it.

2. There is an implementation of a persistent memory pool where you can
allocate and free memory chunks. It supports stream access if you need to
store something larger than single direct I/O element (block). #1 can sit
on top of #2.

3. There is virtual direct I/O layer that supports transactions and makes
it safe against crashes. #2 can sit on top of #3.

4. There is an implementation of various B-trees (maps) including such that
are similar to a relational table with many keys and many values. #4 can
sit on top of #3.

I cannot tell what of this could be useful for you, because I don't know
what are you trying to do.

> Should I stick to normal records rather than use variants for the persistant storage?

See above.

You can store them directly into the persistent memory pool allocating
storage there. You will need some kind of serialization and desrialization
in the form of stream I/O. The persistent memory pool has stream interface.
If you think that serialization is wasting resources, consider portability.
The same storage file should work on a big-endian and little-endian
machine, right? That's is why you should never use Direct I/O with binary
data or stream attributes. The library provides subroutines to serialize
numeric types. Use them to keep stream I/O portable.

You can use the persistent layer if things are complicated. E.g. objects
dependent on each other. Scopes blurred etc. It is possible to have
persistent objects in situ, e.g. a large container of things, graph, tree,
image. Typically very large objects may be too expensive to deserialize.
They may sit in the persistent storage permanently and be accessed via a
proxy object which is serialized and deserialized instead.

Yes, it is complicated, but nobody said it would not be.

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

  reply	other threads:[~2015-04-21  9:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  7:30 Truncating Direct IO files tonyg
2015-04-21  7:47 ` Dmitry A. Kazakov
2015-04-21  8:20   ` tonyg
2015-04-21  9:17     ` Dmitry A. Kazakov [this message]
2015-04-21 22:01 ` Randy Brukardt
replies disabled

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