dnsimple / erldns

DNS server, in Erlang.
MIT License
405 stars 98 forks source link

Feature for storage abstraction in erldns #26

Closed kyle-neal closed 9 years ago

kyle-neal commented 9 years ago

This is the storage abstraction for erl-dns referenced by issue #25. This allows any type of storage to be used simply by adding a new file erldns_storage_STORAGETYPE.erl. You need to set a config variable for using this. Ex: {erldns,[ %% DB Config {storage, [{type, erldns_storage_mnesia}, %% erldns_storage_json | erldns_storage_mnesia {dir, "db"}, {dbname, undefined}, %% name of the db {user, undefined}, %% for future db types {pass, undefined}, %% for future db types {host, undefined}, %% for future db types {port, undefined} %% for future db types ]}, ]}

Otherwise, default is used (erldns_storage_json).

aeden commented 9 years ago

Thank you for this. I'm going to review it today and run it through some tests.

To clarify, there are two primary changes here:

  1. Introduce the storage abstraction
  2. Replace propslist:get_value() with keyfind() as a performance enhancement

Regarding the storage engine, are there use cases for alternate storage engines for the packet cache and throttle? I can think of one right now, which is distribution of the packet cache and throttle data across multiple name servers so they are all aware of the cache data, thus allowing them to avoid certain lookups. Are there other use cases?

aeden commented 9 years ago

I've made some small changes to fix a few things here: https://github.com/aetrion/erl-dns/tree/kyle-neal-master

I am letting this run in production for a bit and then I will complete the merge in aetrion/erl-dns master.