com.scalar.db.storage.dynamo.bytes.BytesEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalardb Show documentation
Show all versions of scalardb Show documentation
A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases
package com.scalar.db.storage.dynamo.bytes;
import com.scalar.db.api.Scan.Ordering.Order;
import com.scalar.db.io.Value;
import java.nio.ByteBuffer;
/**
* A bytes-encoder that encodes a value to bytes while preserving the sort order.
*
* @param the value type
*/
public interface BytesEncoder> {
/**
* Calculates the encoded bytes length.
*
* @param value a value
* @param order an order
* @return the encoded bytes length
*/
int encodedLength(T value, Order order);
/**
* Encodes the value to bytes
*
* @param value a value
* @param order an order
* @param dst a ByteBuffer to write the encoded bytes
*/
void encode(T value, Order order, ByteBuffer dst);
}