Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

madeleine

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

madeleine

  • 0.9.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Madeleine

Madeleine is a Ruby implementation of transparent persistence of business objects, using command logging and complete system snapshots.

https://github.com/ghostganz/madeleine

Usage

require 'madeleine'

# Create an application as a prevalent system

madeleine = SnapshotMadeleine.new("my_example_storage") {
  # Creating the initial empty system. This is how the application
  # is bootstrapped on each startup (until the first snapshot is taken).
  # All the persistent data needs to be reachable from this object.
  # For this example, the application's whole dataset is a hash
  # with a counter:
  {:counter => 0}
}

# To operate on the system, we need commands. For this example,
# we can do additions to our counter:
class AdditionCommand
  def initialize(number)
    @number = number
  end

  def execute(system)
    # This is the only place from where we're allowed to modify
    # the system.
    system[:counter] += @number
  end
end

# Do modifications of the system by sending commands through
# the Madeleine instance:

command = AdditionCommand.new(12)
madeleine.execute_command(command)

# The commands are written to the command log before executed.
# The next time the application starts, all the commands in the
# log are re-applied to the system, returning it to the state it
# had when it was shut down.

# To avoid long start-up times when the command log gets large,
# you can do occasional snapshots of the entire system. You must
# also do a snapshot before deploying any changes in your application
# logic.

madeleine.take_snapshot

A Madeleine instance can be create with an execution context, that will

be passed to all commands as a second argument. This is useful for passing

in things that are neither persistent nor global, e.g. the current Rack application.

madeleine = SnapshotMadeleine.new("my_example_storage", execution_context: rack_app) { Hash.new }

class WebRelatedCommand def execute(system, context) # The context will now be the Rack application ... end end

Requirements

  • Ruby 1.8.7 or later

Contact

Homepage: https://github.com/ghostganz/madeleine

License

BSD (see the file COPYING)

Credits

Anders Kindberg (Bengtsson) - Prevalence core impl.

Madeleine's design is based on Prevayler, the original Java prevalence layer.

With the help of patches, testing and feedback from:

Steve Conover, David Heinemeier Hansson, Johan Lind, Håkan Råberg, IIMA Susumu, Stephen Sykes, Martin Tampe and Jon Tirsén

Thanks to Klaus Wuestefeld and the Prevayler developers for the model of this software; to Minero Aoki for the installer; to Matz and the core developers for the Ruby language!

FAQs

Package last updated on 07 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc