Git Product home page Git Product logo

acid-cell's Introduction

acid-cell

Acid Cell takes a filename generating function and an Acid datatype it then generates the machinery to handle the creation of multiple atomic values of this type according to the unique keys of each one.

This avoids the write locking problem in Acid systems by using two separated data ideas for each piece.

Installation

TODO: Write installation instructions here

Usage

Inputs ...

AcidCells are designed to take a function to retrieve keys and a function to make those keys into filenames

The output of the functions should be unique AcidCell does not check this for you

-- given

-- The user supplies an atomic acid state variable

myAcidStateVariable = x :: SomeAcidState


-- define

myRootDir :: FilePath
myRootDir = "./stateSpace"


-- Fill this guy
data CellKey k h s t st = CellKey { getKey :: st -> (DirectedKeyRaw k h s t)
                                  , codeCellKeyFilename :: (DirectedKeyRaw k h s t) -> Text
                                  , decodeCellKeyFilename :: Text -> (DirectedKeyRaw k h s t)
                                  }
                    

$(makeAcidCell `myCellKey 'initialState ''SomeAcidState )

Creates ...

Here is what the template haskell call above generates.

-- data types for managing states in the cell both active and dormant
data CellCore k h s t stlive stdormant = CellCore { 
      ccLive :: (M.Map (DirectedKeyRaw k h s t) stlive )
      ccDormant :: (M.Map (DirectedKeyRaw k h s t) stdormant )
    }

type TCellCore k h s t stlive stdormant = TVar (CellCore k h s t (TVar stlive) (TVar stdormant))

-- Generate dig for CellCoreDormant
-- These are not directly availalbe to the user
insertCellSomeAcidPath :: CellCore -> SomeAcidState -> Update ...
deleteCellSomeAcidPath :: CellCore -> SomeAcidState -> Update ...
getCellSomeAcidPath    :: CellCore -> SomeAcidState -> Query ...   

-- DIG structure 
data CellCore  k src dst tm tvlive stdormant = CellCore { 
       ccLive     :: TVar (M.Map (DirectedKeyRaw  k src dst tm) tvlive )
      ,ccDormant :: stdormant
    }


-- UI Functions
insertState :: AcidCell -> <SomeAcidState> -> IO (EventResult InsertAcidCellPathFileKey)
deleteState :: AcidCell -> DirectedKeyRaw -> IO Bool
getState      :: AcidCell -> DirectedKeyRaw -> IO (Either AcidCellError SomeAcidState)
queryCell   :: AcidCell -> (SomeAcidState -> a ) -> IO (Either AcidCellError (monoid a))

-- updateState
-- deleteWhere


type AcidCellSomeAcidState = AcidCell SomeAcidState


makeCellSomeAcidState :: IO AcidCellSomeAcidState

Use

someStateManip :: IO ()
    acell <- makeCellSomeAcidState
    drId  <- insertState acell SomeAcidState
    rslt  <- queryCell acell allConsistentStates 
    ast   <- getState acell drId
    deleteState drId 
    

a DirectedKeyRaw is a key with a source and a destination. The source and destination are very arbitrary but were created to deal with database keys coming from multiple locations.

acid-cell's People

Contributors

cotrone avatar lhuang7 avatar smurphy8 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acid-cell's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.