Code Monkey home page Code Monkey logo

amano's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

amano's Issues

Implement versioned item functionallity

Description

amano.VersionedItem class should automatically recognised by save, put and update commands as a versioned (event sourced) entity. Each time a write is made with a versioned item, there should be two writes:

  • write to version 0
  • write to version n, where n is an integer number increased every time item is persisted.

Version of the item should be kept as a part of sort-key. The following is the schema for the versioned sort-key:

{n}:{sort_key}
  • n is the version number
  • sort_key is the user's sort key

Every time read operation is made to a versioned item with a condition, that condition should be automatically ammended and sort key should be either added or modified in the expression to filter only for the latest version 0.

This behaviour can be easily ignored in the userland if two representations are made for the same item, one is versioned the other is a normal item.

References

  • amano.VersionedItem

Test case scenarios

TBC

Support `TransactWriteItems` in table

Description

Possible solution might be using a context to write multiple items to the table

References

Test Cases

  • Write data in a single transaction and assert changes in a table
  • Make write data in a single transaction to fail and assert that table's data is unchanged
  • Write data in a single transaction with a condition and assert changes in a table
  • Write data in a single transaction with a condition in the way it fails and asssert table's data is unchanged

Implement the save method in the `amano.Table` class

Description

Save method should consider the state of the item passed to it. If the item is in a new state, a put command should be executed. If the item is in dirty state an update command should be executed, otherwise save should return false.

Code References

  • amano.Table.save
  • amano._ItemState
  • amano.Item._state

Scenarios for test coverage

  • Save item in a new state
  • Save item in a dirty state
  • Save item in a clean state
  • Save item with a condition in a new state
  • Save item with a condition in a dirty state
  • Save item with a condition in a clean state

Implement the scan method in the `amano.Table` class

Description

Scan method should support standard condition expression and return a cursor. Scan method should also support consistent reads and limit parameter.

References

  • amano.Table.scan
  • amano.condition.Condition

Test case scenarios

  • Scan method with just a condition
  • Scan method with a condition and limit
  • Scan method with a consistent read option enabled and a condition

Provide abstraction over `ScannedCount` and `Count` information in the `amano.Cursor`

Description

At the moment count in cursor is calculated by retrieving all the items from dynamodb. We could optimise this behaviour by utilising ScannedCount and Count information: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html#Query.Count

Additionally we could abstract all the informations returned by dynamodb and provide it back to user.

References

  • amano.Cursor.count
  • amano.Cursor

Support batch write operation

Description

Support batch write operation. There should be three methods provided in the table batch_save and batch_delete and batch_write.

batch_save should be used to persist multiple items in the table at once

batch_delete should be used to remove multiple items from the table at once

batch_write should be capable of removing or persisting items

All of the methods above should probably support conditional statements.

References

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.