Giter Site home page Giter Site logo

detyra's Introduction

Decisions made

The Wallet App will hold its users on a map data structure. The key for the map will be user's email address.

In real-life scenarios a user would have more than one wallet, but to simplify the example I choose to have only one wallet per user.

A very good data store for the users and wallets would be a key/value data store (like Redis, BadgerDB, etc.) or even a graph database (Dgraph, Neo, etc.) but to simplify the example I decided to mock the key/value data store (in_memory package that is inside repo package).

To keep the app performant, I would use pipeline concurrency pattern, so for every transaction I would publish a transaction in a channel, and would have another goroutine that listens to the transaction channel and save the transaction in database concurrently.

Setting up and executing the code

Running the app

To run a test code, execute the following command:

go run main.go

Running unit tests

To run unit tests for the wallet, go to the wallet folder by using the command:

cd ./wallet

thne run unit test by using the command:

go test -v

To run unit tests for the store, go to the store folder by using the command:

cd ./store

thne run unit test by using the command:

go test -v

Areas to be improved

  • More unit tests and better test coverage
  • Make the application concurrent
  • If there is a large number of users, split the users into shards and run a separate instance for each shard
  • Use a distributed key/value store to store users and wallets
  • Use a blob storage to store transactions
  • Setup a monitoring and alerting

detyra's People

Contributors

fitims avatar

Watchers

 avatar

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.