-
Notifications
You must be signed in to change notification settings - Fork 14
Datatypes
As of 8/21/2013, Cuttlefish supports the following datatypes:
integer
is exactly what it sounds like.
enum
is great! You know the fixed set of options for a setting, so
use this one. Those fixed options are provided in the second element
of the enum tuple.
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
is the default datatype. Everything in a .conf
file is a
string anyway, so we're guaranteed a successful conversion.
duration
s 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.
duration
s manifest in .conf
files as strings like this: 1w2d
.
The following units are supported:
- f - fortnight
- 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.
duration
will convert automatically to BaseUnit in your app.config.
If you want it to be seconds instead of milliseconds, just use the
datatype {duration, s}. It will round up to the nearest second, so
1ms=
999ms=
1s`. Confused? You won't be, after this week's
episode of...Soap.
In your app.config, these will end up as bytes in integers, so 1KB = 1024.
bytesize
will work pretty much like duration
but with three
differences.
- The units will are
MB
,KB
, andGB
- If no unit is specified, it's just bytes
- You will only be able to use ONE unit. e.g. no
4gb3kb
<- that makes no sense!
Note: lowercase units (i.e. gb
, mb
, and kb
) are ok, but mixed
case are not. That's to avoid confusion with Megabits
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.