const BLOB_SIZE = latte::param!("blob_size", 16); const INSERT = "insert"; const KEYSPACE = "latte"; const TABLE = "blob"; pub async fn schema(db) { db.execute(`CREATE KEYSPACE IF NOT EXISTS ${KEYSPACE} \ WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }`).await?; db.execute(`DROP TABLE IF EXISTS ${KEYSPACE}.${TABLE}`).await?; db.execute(`CREATE TABLE ${KEYSPACE}.${TABLE}(id bigint PRIMARY KEY, data BLOB)`).await?; } pub async fn erase(db) { db.execute(`TRUNCATE TABLE ${KEYSPACE}.${TABLE}`).await } pub async fn prepare(db) { db.prepare(INSERT, `INSERT INTO ${KEYSPACE}.${TABLE}(id, data) VALUES (:id, :data)`).await?; } pub async fn load(db, i) { } pub async fn run(db, i) { db.execute_prepared(INSERT, [i, latte::blob(i, BLOB_SIZE)]).await? }