Skip to content

A small helper to create stream resource from disk_log logs

Notifications You must be signed in to change notification settings

nyo16/disk_log_stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiskLogStream

DiskLogStream can create streams from disklog logs Is helpfull if you want to iterate over WAL, or audit trails

Installation

If available in Hex, the package can be installed by adding disk_log_stream to your list of dependencies in mix.exs:

def deps do
  [
    {:disk_log_stream, "~> 0.1.0"}
  ]
end

How to use it

 import DiskLogStream

 log_name = :test_log
 log_path = '/tmp/test_log.bin'

 # open the a log, the name is atom, the path charlist.
 log_name = open(log_name, log_path)

 # log some terms, binaries etc.. pretty much everything that can be converted with term_to_binary
 sync_log(log_name, "example term 1")
 sync_log(log_name, "example term 2")
 sync_log(log_name, [:a, :b, "term", 1234])

 iex(11)>  create_stream(log_name, log_path)  |> Stream.map(fn lg_entry -> lg_entry end)  |> Enum.to_list()
 ["example term 1", "example term 2", [:a, :b, "term", 1234]]

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/disk_log_stream.

About

A small helper to create stream resource from disk_log logs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages