Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

hildebrand.streams

Moe Aboulkheir edited this page Aug 6, 2015 · 13 revisions

Functions for working with Dynamo Streams API. Function names are linked to the corresponding AWS API documentation.

(describe-stream! creds stream-arn
  & [{:keys [limit]} {:keys [chan close?]}])

Example Response

{:stream-arn "arn:aws:dynamodb:...",
 :creation-request-date-time 1437398764358,
 :key-schema [:user-id :game-title],
 :shards
 [{:sequence-number-range [100000000000042013365N nil],
   :shard-id "shardId-00000001437398769772-bd6e16aa"}],
 :stream-label "2015-07-20T13:26:04.362",
 :stream-status :enabled,
 :stream-view-type :new-and-old-images,
 :table-name :hildebrand-test-table-indexed}
  • As with the Dynamo functions in hildebrand.core, the key schema representation is either [hash-key] or [hash-key range-key]
  • Shard sequence numbers are represented as vectors of [start end], with end nil for open shards. Sequence numbers are parsed as bigints.
(get-records! creds shard-iterator
  & [{:keys [limit]} {:keys [chan close?]}])
(get-shard-iterator! creds stream-arn shard-id iterator-type
  & [{:keys [sequence-number]} {:keys [chan close?]}])
  • Valid values for iterator-type are :at-sequence-number, :after-sequence-number, :trim-horizon and :latest. The first two require a :sequence-number to be specified.
  • stream-arn can be obtained from describe-stream!, or by passing a table name latest-stream-arn!
  • shard-id is obtainable from hildebrand.streams.channeled/get-shards! or via describe-stream!
(list-streams! creds & [{:keys [limit table-name]} {:keys [chan close?]}])

latest-stream-arn!

(latest-stream-arn! creds table-name & [_ {:keys [chan close?]}])
  • Returns the latest stream ARN for the Dynamo table with the given name
  • Performs a describe-table! and returns the value of :latest-stream-arn