Commit 866b5b3a authored by Paul Asmuth's avatar Paul Asmuth
Browse files

cleaning up :)

parent 8e65e4c7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ retrieves the value of a metric at one point in time

*Response:*

    Float
    Float or "null"

*Example:*

@@ -75,7 +75,7 @@ Retrieves all values of a metric in a time interval

*Response:*

    Comma-seperated Timestamp:Float tuples
    Comma-seperated Timestamp:Float tuples or "null"

*Example:*

+9 −2
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ class SwapFile(metric_key: MetricKey) {
  val buffer = ByteBuffer.allocate(512)
  buffer.order(ByteOrder.BIG_ENDIAN)

  // adds a new (time, value) tuple to be written to the swap file
  // but does not write it yet. this method is not thread safe!
  def put(time: Long, value: Double) : Unit = {
    val bvalue = java.lang.Double.doubleToLongBits(value)

@@ -36,9 +38,14 @@ class SwapFile(metric_key: MetricKey) {
    buffer.putLong(bvalue)
  }

  // fluhes the queued writes from the buffer to disk. this method
  // is not thread safe!
  def flush : Unit = {
    file.synchronized {
      file.seek(write_pos)
      file.write(buffer.array)
    }

    write_pos += 18
    buffer.rewind
  }