Asd

Asd

AtomicFlags - mutable runtime configuration on top of atomics

A very short and simple library which implements compile-time enums on top of erlang :atomics module.

Use cases

  1. Configuration, where values change in runtime
  2. Configuration, where values are accessed frequently and accessing them become a bottleneck
  3. Inter-process store for some flags, options or parameters.

Example

defmodule FeatureFlags do
  use AtomicFlags, schema: [
    feature_enabled: [false, true]
  ]
end

iex> require FeatureFlags
iex> flags = FeatureFlags.new()
iex> FeatureFlags.set(flags, :feature_enabled, true)
iex> FeatureFlags.get(flags, :feature_enabled)
true

Or with global: true

defmodule GlobalFeatureFlags do
  use AtomicFlags,
    global: true,
    schema: [
      feature: [:disabled, :for_preview, :enabled]
    ]
end

iex> require GlobalFeatureFlags
iex> GlobalFeatureFlags.new_global()
iex> GlobalFeatureFlags.set(:feature, :for_preview)
iex> GlobalFeatureFlags.get(:feature)
:for_preview

My experience

I am using a version of this library in my pet project and it is working fine, showing really good performance, compared to application env ets

First Post!

thiagomajesk

thiagomajesk

Great job! Slap a live dashboard page on top of it for configuration, and then you can compete directly with LaunchDarkly, haha :rocket:

Where Next?

Popular in Announcing Top

tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
mspanc
I am pleased to announce an initial release of the Membrane Framework - an Elixir-based framework with special focus on processing multim...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New
zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps w...
New
josevalim
Hello everyone, We have just released NimbleCSV which is a small and fast CSV parsing library for Elixir. It allows developers to define...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New

Other popular topics Top

chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39523 209
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement