Skip to content

Datatypes

Sean Cribbs edited this page Aug 16, 2013 · 11 revisions

Existing Datatypes

As of 8/16/2013, Cuttlefish supports the following datatypes:

integer

integer is exactly what it sounds like.

enum

enum is great! You know the fixed set of options for a setting, so use this one.

ip

The ip datatype exists currently as an IP/Port combo, and it's currently under discussion as to whether or not we want ip and ip/port to be different datatypes.

string

string is the default datatype. Everything in a .conf file is a string anyway, so we're guaranteed a successful conversion.

Datatypes scheduled for addition

duration

durations are fixed intervals of time, the largest unit of which will be a one week. Anything larger will have to be expressed in terms of weeks, since larger units (month, year) are of variable duration. durations manifest in .conf files as strings like this: 1w2d.

The following units are supported:

  • w - week
  • d - day
  • h - hour
  • m - minute
  • s - second
  • ms - millisecond

You can use any combination of these. I'm not sure why you'd want to specify 1w13ms, but you can.

Did I mention you can use floats here? "0.5d"? no probalo.

Keep your eyes on this file cuttlefish_duration.erl for developments on this.

file / dir

file / dir only exists as an idea at this point. It will allow for included validators like valid path and exists. Some files may need to exist, some may not. some may need to be writable. I'm not sure this makes the first release.

size

size will work pretty much like duration but with two differences.

  • The units will be things like mb, kb, and gb
  • You will only be able to use ONE unit. e.g. no 4gb3kb <- that makes no sense!