Andreas Garnæs

Envelope Encryption with Amazon KMS

Amazon Key Management Service is a service for creating and controlling encryption keys in a safe manner, using Hardware Security Modules under the hood. KMS also offers hassle-free yearly key rotation, and logs all key usage to CloudTrail by default.

Efficient Use of Core Reader and Writer

In a previous blog post, I used Core, Async and bitstring to write a tiny library for talking to Memcached using the binary protocol. Reader and Writer are the primary I/O abstractions used in Core and also underlies my implementation. To better understand the mechanics of Reader and Writer and how to use them efficiently, I decided to examine the implementations and APIs more closely. The following is a summary of my findings.

How to test Async Ocaml code

In the previous blog post, we used Core and Async to write a tiny library for talking to Memcached using the binary protocol. I wanted to write tests for the library in a readable and succint manner to ensure correctness -- the type system cannot ensure binary data is parsed correctly after all. The regular go-to tool for testing Ocaml code is OUnit, but this doesn't work well with Async. As I couldn't find a suitable library, I decided to write something myself.

Improved OCaml Memcached client with Core and Async

In the previous blog post, we implemented a simple Ocaml library for talking to Memcached with the binary protocol using bitstring. The code uses the baked-in standard library and synchronous IO (blocking), so a lot of time will be wasted waiting for IO. The standard library replacement Core offers cooperative threading with callbacks through Async, similar to Javascript, EventMachine for Ruby or many others. In this blog post we'll try to rewrite the code from the previous post to use asynchronous IO with Async.

Implementing the Binary Memcached Protocol with Ocaml and Bitstring

I've known Ocaml for a while, but I never really put it to use outside of academic work back in university. After reading Real World Ocaml my excitement for Ocaml reappeared and I wanted to try out Core and Async. At the back of my mind, I also remembered bitstring, an awesome Ocaml library for creating and pattern matching on bitstrings. To cover all three, I decided to write a Memcached client using the binary protocol.