Git Product home page Git Product logo

tx-stats's Introduction

Transaction Statistics Server

For task details, check the Backend Code Assignment.pdf file

Implementation Details

Time complexity: O(1)

Space complexity: 0(1)

Space estimations:

       // 70 bytes * 120_000 records (max cache size before cleanup) = 8MB
       internal data class StatsRecord(val t: Long, val amount: Long, val orderCount: Int) {

Tech stack:

  1. Kotlin 1.3
  2. Gradle 5.5
  3. Micronaut Framework 1.2 [https://micronaut.io]
  4. Junit 5
  5. Docker
  6. GraalVM Native Image [https://www.graalvm.org/docs/reference-manual/aot-compilation/]

Build

Build local JAR file: ./gradlew shadowJar

After local build's success, build and run with Docker: docker build .

Run locally

 
   08:35:41.166 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 1949ms. Server Running: http://localhost:8080

Development guides

Set up your IDE to support Micronaut:

  1. Intellij IDEA: enable annotations and delegate all build tasks to Gradle
  2. Other IDEs: https://docs.micronaut.io/latest/guide/index.html#ideSetup
  3. Build, run and continuously rebuild with Gradle: ./gradlew run --continuous and then after changing a kotlin file this restart message should appear:
08:58:47.667 [main] INFO  io.micronaut.runtime.Micronaut - Startup completed in 873ms. Server Running: http://localhost:8080

Running Tests

  1. Run tests from IDE and check the output: 08:52:43.653 [Test worker] INFO ebay.tx.stats.TxRepoTest - Population time: 296.4 ms Calculation time: 25.41 ms
  2. Run tests with Gradle ./gradlew clean test

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.