Sunday, January 8, 2017

File Structure

Miranda has the following directory structure:

Name Default Description
com.ltsllc.miranda.ClusterFile data/cluster.json Where the system keeps information about the cluster
com.ltsllc.miranda.UserFile data/users.json Where the system keeps information about the users
com.ltsllc.miranda.TopicsFile data/topics.json Where the system keeps information about the system topics
com.ltsllc.miranda.SubscriptionsFile data/subscriptions.json Where the system keeps information about the subscriptions
com.ltsllc.miranda.MessagesDirectory data/messages The directory where the system keeps the messages files
com.ltsllc.miranda.DeliveriesDirectory data/deliveries The directory where the system keeps the deliveries files

Miranda keeps several messages files. Each one holds 100 messages.  The files are named with the index of the first message in the file, so the first one is named "1.json" the next "101.json" and so on.

Deliveries are kept in a directory with the name of the subscription, with the files named for the index of the first message in the file.  The deliveries are kept in groups of 100 so the first file is named "1.json" the second "101.json" and so on.

All files are JSON, cluster.json contains a list of hosts, users.json contains a list of users, topics.json contains a list of topics and suscriptions.json contains a list of subscriptions.

The messages file contains messages in the system.  Each of the files in the deliveries directory   contains a list of delivery objects.

Saturday, January 7, 2017

Property Defaults

Some of the Miranda properties and their default values:

Name Default Description
com.ltsllc.miranda.ClusterFle data/custer.json The cluster file.
com.ltsllc.miranda.UsersFile data/users.json The users file.
com.ltsllc.miranda.TopicsFile data/topics.json The topics file.
com.ltsllc.miranda.SubscriptionsFile data/subscriptions.json The subscriptions file.
com.ltsllc.miranda.MessagesDirectory data/messages The directory where messages files are kept.
com.ltsllc.miranda.DeliveriesDirectory data/deliveries The directory where deliveries files are kept.
com.ltsllc.miranda.TopicsPort 443 The port that Miranda listens to for new messages
com.ltsllc.miranda.ClusterPort 6789 The port that Miranda listens to for new cluster nodes.

I decided to prefix all the properties with "com.ltsllc.miranda" to keep them separate from other properties.

I will add to this as new properties occur to me.

Friday, January 6, 2017

Property Augmentation

Property Augmentation is the process of adding new properties to an object without doing anything to existing properties.

Miranda uses this when it defines its properties and their default values.

Miranda looks at the command line for a properties file, but if it doesn't find one it looks in the system properties for a property named MirandaProperties.PROPERTY_SYSTEM_PROPERTIES (currently defined to be "com.ltsllc.miranda.Properties").  If that is not defined then the system uses the default name (currently "miranda.properties").

The system augments the system properties with default values (defined by MirandaProerties.DEFAULT_PROPERTIES) and then, if the properties file exists.  It tries to load that file and it uses that to augment the system properties.

One of the things about augmentation is that the last write wins, so this is really a long winded way of getting the system properties.

Wednesday, January 4, 2017

Properties

I think that all the files for Miranda will be JSON; except I'm not sure about the main properties file.

I can't decide if it will be a "regular" properties file (one that java.utils.Propertis can handle) or JSON.

The application properties file will have things like what the other files are, what ports Miranda listens to, etc.

I will probably "decide" several times so I don't know what I'm worrying about.

I think that, at first, I will go with a standard properties file, and change my mind if circumstances dictate otherwise.

Sunday, January 1, 2017

Prospero

The name Prospero comes form the play The Tempest by William Shakespeare.  The  original Prospero system was written by Chris Chew in Erlang with a little help from me (I wrote a module that parsed XML).

Miranda is a Java port of Prospero with a few changes.  First of all it is written in Java instead of Erlang. It was very difficult to find people who had done functional programming (other than JavaScript) let alone Erlang so I view this as an improvement.

Secondly, Miranda doesn't need RabbitMQ.  This meant that you needed a whole other cluster devoted to RabbitMQ which had to have fast access to your nodes to work.

Finally, Prospero used Mnesia.  In addition to backups (Mnesia had the unfortunate habit of corrupting its files), Mnesia didn't cross AWS availability zones too well.  Miranda is designed to run with nodes in different availability zones.  

Saturday, December 31, 2016

The Name

The name "Miranda" comes for the play The Tempest by William Shakespeare.  Miranda is basically a Java port of a system called Prospero which was written by Chris Chew at eCollege and later released to open source as "subpub".

In the play Miranda is the daughter of Prospero so the name naturally presented itself.   I never liked "subpub" anyways.

Friday, December 30, 2016

The First File

This was more work than I thought it would be.

You'd think that someone who has been doing software as long as I have would know better but nooo!  I thought that the first few classes would write themselves.

It took me several hours.

And the worst thing is that it's still not done.

I meant for this blog to be a kind of developer's diary.  And it's already shaping up to be a catalog of my erm challeges