apache / fluo

Apache Fluo
https://fluo.apache.org
Apache License 2.0
186 stars 78 forks source link

Represent column type as Java enum and provide utility methods for conversion #178

Open mikewalch opened 9 years ago

mikewalch commented 9 years ago

Fluo has several column types (DATA, ACK, LOCK, WRITE, DEL_LOCK, etc). These column types are stored in 3 bits of the timestamp and retrieved using a mask. Columns types are passed around as long and compared to constants (see ColumnConstants class). When a user wants to write a column they need to embed the column type into the timestamp.

While the design above works well and should remain, it would be nice to represent column types as a Java enum type in most Fluo code. Utility methods for embedding and retrieving the column type from a timestamp could be created. These methods could also have error checking. Fluo classes (like Flutation) that write to Accumulo tables could accept ColumnType as a parameter to their methods and perform the embedding of column type into the timestamp for the user using the available utility methods.

cjnolet commented 9 years ago

The ordinality of the enums could easily replace the current long that's being passed around. +1