mudasobwa

mudasobwa

Creator of Cure

The very simple :ets wrapper simplifying cross-process :ets handling (like Agent, but :ets.)

NimbleETS is a very thin simple ETS wrapper, simplifying the trivial usage of ETS as key-value store. It is not intended to replicate :ets module functionality by any mean. It might be used as a drop-in to avoid process-based Agent as key-value store. It exposes only CRUD functionality of ETS, alongside with Access behaviour.

defmodule MyApp.MyModuleBackedByTable do
  use NimbleETS
end
MyApp.MyModuleBackedByTable.ets_put(:foo, 42)
MyApp.MyModuleBackedByTable.ets_get(:foo)
#⇒ 42

MyApp.MyModuleBackedByTable.ets_del(:foo)
MyApp.MyModuleBackedByTable.ets_get(:foo, :bar)
#⇒ :bar

nimble_ets v0.1.0 — Documentation / GitHub - am-kantox/easy_ets: The very simple ETS wrapper simplifying cross-process ETS handling (like `Agent`, but `:ets`). · GitHub

Showing Posts 1 to 8

OvermindDL1

OvermindDL1

Hmm, Nimble* projects in the elixir ecosystem generally mean things that are the fastest possible implementation of something, how does this make ETS operations faster?

mudasobwa

mudasobwa OP

Creator of Cure

Yeah.

I had initially have called it NimbleAgent, then I realized it has nothing to do with Agent and I finally screwed the name totally up. It obviously does not make :ets any faster, but it also does not make it any slower, but the development process becomes faster.

OvermindDL1

OvermindDL1

Heh, following the pattern of Jose’s Nimble* libraries the development is often ‘slower’ than other libraries, but it ‘executes’ faster, it’s all a trade-off. ^.^

mudasobwa

mudasobwa OP

Creator of Cure

I’ll probably revoke the package during the weekend and re-deploy it as NimbleAgent as in was intentionally supposed. Nobody needs to know that there is :ets behind and it’s indeed notably faster than Agent on significant amount of CRUD operations.

OvermindDL1

OvermindDL1

It would indeed be a faster agent for setting/retrieving information, but that’s not what Agents are for. Agents are to do some processing of data on the agent state in another process so it doesn’t block your own process or for synchronization reasons (otherwise using ETS just for multi-process data storage with, say, the Eternal library for ease of use). If this uses ETS to do operations with no backing process then any functions called would need to be run in-process, thus blocking the existing process.

Like from the Agent docs itself:

    # Compute in the agent/server
    def get_something(agent) do                                                                                                                    
      Agent.get(agent, fn state -> do_something_expensive(state) end)                                                                              
    end                                                                                                                                            
                                                                                                                                                   
    # Compute in the agent/client                                                                                                                  
    def get_something(agent) do                                                                                                                    
      Agent.get(agent, & &1) |> do_something_expensive()                                                                                           
    end  

It uses this as an example of this, where the top does the expensive operation in the agent and the second does it in the caller, either of which can be preferred depending on what the purpose is, but if an ETS data store is used then I’m not sure how you could call operations on the Agent side without blocking your own process (like using Agent.cast/2,4). Agent’s aren’t just for holding data, you can use ETS for that, Agents are for running operations on that data in another process synchronously, and I don’t see how you could do that on a pure ETS table without a backing process?

josevalim

josevalim

Creator of Elixir

It is not really an agent though. It is the same API, but the operational semantics are very different. For example, agents should be supervised.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Maybe call it EasyEts ? I think that captures what you’re going for better than the Nimble prefix.

mudasobwa

mudasobwa OP

Creator of Cure

The package was renamed to EasyETS, thank you all.

The backing process is planned in 0.2.

My goal is to bring the operational semantics to be more or less the same as Agent has in the forthcoming updates. I posted the very alpha version to gather advises and thanks I received all I wanted.

Yes, thank you, I came to the exactly same name. All done.


FWIW, I retired NimbleETS at HexDocs.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews