• Stars
    star
    363
  • Rank 113,040 (Top 3 %)
  • Language
    Elixir
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ecto 3 adapter allowing use of Ecto schemas held in ETS tables

Etso

Etso is an ETS adapter, allowing you to use Ecto schemas with ETS tables.

Within this library, a bare-bones Ecto Adapter is provided. The Adapter transparently spins up ETS tables for each Ecto Repo and Schema combination. The tables are publicly accessible to enable concurrency, and tracked by reference to ensure encapsulation. Each ETS table is spun up by a dedicated Table Server under a shared Dynamic Supervisor.

For a detailed look as to what is available, check out Northwind Repo Test.

Highlights & Benefits

Key highlights of this library are:

  • It transparently handles translations between Ecto.Schema structs and ETS tuples.
  • It knows how to form ETS Match Specifications for simple queries.

Key points to consider when adopting this library are:

  • It is suitable for rapid retrieval of simply formatted data, for example presets that do not change frequently.
  • It is not suitable for use as a full-fledged data layer unless your requirements are simple.

Feature Coverage

The following features are working:

  • Basic query scenarios (C / R / U / D)
    • Insert all (c:Ecto.Repo.insert_all/3, etc.)
    • Insert one (c:Ecto.Repo.insert/2, etc.)
    • Get all (c:Ecto.Repo.all/2, etc.)
    • Get by ID (c:Ecto.Repo.get/3, etc.)
    • Get where (Ecto.Query.where/3, etc.)
    • Delete by ID (c:Ecto.Repo.delete/2, etc.)
  • Selects
  • Assocs
  • Preloads

The Northwind Repo Test should give you a good idea of what’s included.

Missing Features

The following features, for example, are missing:

  • Composite primary keys
  • Dynamic Repos (c:Ecto.Repo.put_dynamic_repo/1)
  • Aggregates (dynamic / static)
  • Joins
  • Windows
  • Transactions
  • Migrations
  • Locking

Installation

Using Etso is a two-step process. First, include it in your application’s dependencies:

defp deps do
  [
    {:etso, "~> 1.1.0"}
  ]
end

Afterwards, create a new Ecto.Repo, which uses Etso.Adapter:

defmodule MyApp.Repo do
  @otp_app Mix.Project.config()[:app]
  use Ecto.Repo, otp_app: @otp_app, adapter: Etso.Adapter
end

Once this is done, you can use any Schema against the Repo normally, as you would with any other Repo. Check out the Northwind modules for an example.

Utilisation

Originally, Etso was created to answer the question of whether ETS and Ecto can be married together. It has since found some uses in production applications, serving as a Data Repository for pre-defined nested content. This proved invaluable for rapid iteration.

If you have other Use Cases for this library, please add it here with a Pull Request.

  • The Erlef Website is using Etso to cache and query news and event posts that are parsed and imported into the Repo on application startup.

Further Note

This repository is extracted from a prior project ETS Playground, which was created to support a session at ElixirConf EU 2019, Leveraging ETS Effectively.

Specifically, this library was created to illustrate the point that ETS can serve as a scalable storage layer for data which changes infrequently. Check out the Northwind Importer for an example.

Acknowledgements

This project contains a copy of data obtained from the Northwind database, which is owned by Microsoft. It is included for demonstration and testing purposes only, and is excluded from the distribution. The Author thanks Microsoft Corporation for the inspiration.

The Author also wishes to thank the following individuals:

More Repositories

1

LiveFrost

Real time blurring for iOS
Objective-C
485
star
2

DayFlow

iOS Date Picker + Infinite Scrolling
Objective-C
229
star
3

packmatic

Zipping on the fly — Generate downloadable Zip streams by aggregating File or URL Sources
Elixir
140
star
4

RAPageViewController

Sliding pages side by side, infinitely. Fancy parts from the redacted bits, re-implemented for expressiveness at expense of some naïvety
Objective-C
78
star
5

shun

Easy & flexible traffic filtering with Elixir
Elixir
78
star
6

supervised-scaler

An Elixir integration with libVIPS
Elixir
44
star
7

LESS.mode

LESS syntax mode for SubEthaEdit and Coda
Perl
38
star
8

emporium

Elixir
35
star
9

DayFlow-Sample

Sample application for DayFlow the picker
Objective-C
30
star
10

ets-playground

Leveraging ETS Effectively
Elixir
28
star
11

RAExpendable

NSObject subclass with dynamically added implementations for custom selectors
Objective-C
27
star
12

SocialAuth

Painless Facebook & Twitter auth on iOS 6+
Objective-C
26
star
13

RATilingBackgroundView

A special view which tiles visually identical subviews.
Objective-C
24
star
14

snake

🐍 Multi-Snake 🐍 — A showcase of Elixir clustering capabilities and strategies.
Elixir
21
star
15

LiveFrost-Sample

Sample for LiveFrost
Objective-C
20
star
16

RAProjectTools

Collection of Xcode project “tool” scripts
Ruby
15
star
17

RASchedulingKit

Callback-based, lock-less, wait-free NSOperation subclasses
Objective-C
15
star
18

metrics

Metal Charting
Objective-C
12
star
19

RAReachability

Yet another SystemConfiguration Reachability Wrapper
Objective-C
11
star
20

RAContentStretchingView

UIView content stretching / grouped table view cells done right
Objective-C
10
star
21

gemini-notes

Gemini PDA Notes
10
star
22

RAContentLoader

Reference-counted content loading
Objective-C
10
star
23

RARangedSlider

Ranged (two-knob) slider for iOS
Objective-C
10
star
24

RAPageViewController-Sample

Sample app for RAPageViewController
Objective-C
9
star
25

xyozys_gen_statem

tic-tac-toe with gen_statem (in Elixir)
Elixir
8
star
26

html5shiv

unofficial fork of html5shiv on Google Code
JavaScript
8
star
27

PLSymbolicate

Symbolicate protobuf output from PLCrashReporter et. al.
7
star
28

WeakKVO

Sample: emitting KVO change notifications for weak properties
Objective-C
6
star
29

irInterfaceKit

Custom interface kit for Cappuccino
Objective-J
6
star
30

FixedWidthWebView

fixed-width UIWebView implementation for containment in UIViewController
Objective-C
5
star
31

NSWindow-Resize

5
star
32

angular-chosen-playground

Chosen + AngularJS + Typeahead + Auto-Suggestion with good search performance on 10,000 items
4
star
33

flesler-plugins

Fork of flesler-plugins
JavaScript
4
star
34

NSStatusItem-Iconology

NSStatusItem iconology helper methods
Objective-C
4
star
35

InvocationTesting

Objective-C Method forwarding fun (not that it will be fast)
Objective-C
4
star
36

hero

Heroku account swizzling helper
Ruby
3
star
37

NSTableView-DeleteKey

Objective-C
3
star
38

kennel

Sample Hound + Headless Chrome application
Elixir
3
star
39

slate

Custom Plurk theme
3
star
40

RATilingBackgroundView-Sample

Sample app for RATilingBackgroundView
Objective-C
3
star
41

monoSnippets

Minimalist jQuery / JavaScript / Sass tool chain for a more civilized web
JavaScript
3
star
42

termHere

Terminal niceties for for Coda
2
star
43

CommonCrypto.j

Crypto Support for Cappuccino
Objective-J
2
star
44

UIScrollViewExperiments

Just a bunch of experimental code
Objective-C
2
star
45

ReflectiveMapView

HACKY: Same story regarding iOS 6 status bar, but done for CAEAGLLayer as well.
Objective-C
2
star
46

SocialAuth-Sample

Sample for SocialAuth
Objective-C
2
star
47

CPTableview-customDataView-selectionTest

CPTableview custom data view -setSelected:animated: experiment
Objective-J
2
star
48

RAAnimation

WIP: UIKit / QuartzCore Animation Additions
Objective-C
2
star
49

gridViewNibTest

Loading AQGridViewCell from a nib
Objective-C
2
star
50

PinchThat

An attempt to fix an Apple UICollectionView WWDC sample app issue with duplicate decoration views
Objective-C
2
star
51

glitter

Bare-bones zBar-to-UIWebView trampoline
Objective-C
2
star
52

MNCodaHighlighter

1
star
53

jQuery.spin.js

Spin any image using Raphaël. Adoption.
1
star
54

cloudy

WIP — Desktop / Mobile Continuum for iTunes Track Info
1
star
55

js.delegatable

Cocoa-style delegation support for JS.Class
JavaScript
1
star
56

TabBarDemo

Objective-C
1
star
57

myGit

Shows how to call “which” from a Cocoa app while respecting the user’s $PATH
Objective-C
1
star
58

jQuery.multiFile

JavaScript
1
star
59

wczg-2018-concurrent-js

Examples for the “Fearless Concurrency with JavaScript & Beyond” talk @ WebCamp Zagreb, 2018
JavaScript
1
star
60

monoArray

array.supersets(), etc.
JavaScript
1
star
61

retinal

Ordinary + @2x Illustrator .PNGs in one click
JavaScript
1
star
62

LWHangDetector

LWHangDetector in repository form
Objective-C
1
star
63

js.synthesizable

1
star
64

monoTwitterEngine

jQuery-based Twitter API
JavaScript
1
star
65

snapshot

Make copies, make many of them
1
star
66

code-your-startup-idea

Samples for a She++ 2013 Session
1
star
67

AQGridView-Issue-171-Sample-1

AlanQuatermain/AQGridView Issue #171 Sample 1
Objective-C
1
star
68

RotationTest

Some sort of rotation math.
Objective-C
1
star
69

regulation

RegEx testing
JavaScript
1
star
70

evadne.github.com

Site
HTML
1
star
71

7languages

7 Languages in 7 Weeks…
Io
1
star
72

tidyCJK.js

Spaces Chinese, Japanese and Korean glyphs properly — before browsers learned how to kern them. Needs XRegExp!
JavaScript
1
star
73

irDelegation

Easy delegation and protocol support for Cappuccino
Objective-J
1
star
74

monoMailer

PHP mail() wrapper
PHP
1
star
75

CPObject-DelayedPerforming

Cappuccino CPObject Delayed Performing
Objective-J
1
star
76

jQConstants

Semantic jQuery addition that brings legible constants
JavaScript
1
star
77

NSBundle-Information

Objective-C
1
star
78

stochastic

Full gamut of RGBA.
Ruby
1
star
79

markdown-previewer

1
star
80

RAContentStretchingView-Sample

Sample for RAContentStretchingView
Objective-C
1
star
81

radiance

Custom WordPress theme using Journalist as a starting point
PHP
1
star
82

NSMutableArray-Shuffling

Objective-C
1
star
83

CodaPluginsController.h

The missing header for Coda plug-ins.
1
star
84

KVC.js

Minimalist JavaScript Key-Value Coding support
1
star
85

monoString

JavaScript String additions
JavaScript
1
star
86

ObjC-SwizzleMethods

Obj-C method swizzling wrapper
C
1
star
87

wp-e-commerce

Forked WP e-Commerce plugin
PHP
1
star
88

SortedSectionTest

Sorting NSFetchedResultsController sections on rigid but arbitrary principles
Objective-C
1
star
89

innerShadowedTextSample

Custom UILabel drawing with inner shadowed text
Objective-C
1
star
90

Aperio

markit finance api client
Objective-C
1
star
91

vips-buildpack

VIPS + Anvil + Heroku
Shell
1
star
92

monoDate

JavaScript Date additions, including a minimal, template-based, Ruby-flavored formatter
JavaScript
1
star
93

ISO8601DateFormatter

Mirror.
Objective-C
1
star
94

StickyHTMLTableHeaders

Fun with HTML
JavaScript
1
star
95

coursework-introductory-core-data

Introductory Core Data tutorial
Objective-C
1
star
96

pictorial

Your tiny, automated image post-processing factory
Ruby
1
star
97

snipMe

Drop-dead fool-proof in-line localization
1
star
98

helveticSafari

Arial bashers rejoice.
1
star