Skip to content

briheet/Tkgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tkgo

Token Pool for tracking, Simulation

Tkgo is a quick, runtime memory, offline-storage for Token pool

  • Written in Golang
  • Uses golang's self sufficient standard library
  • Quick, read-write safe, easy to use

Features

  • Create a new user with a predefined number of tokens and a simulation time limit.
  • Retrieve the least-used token for a given user.
  • Automatically stop token allocation once the simulation limit is reached.
  • Uses an in-memory storage system for fast operations.

Tech

Tkgo uses a number of projects to work properly:

Installation

Tkgo requires Golang to run.

Install the dependencies and devDependencies and start the server.

# Clone the repository
git clone https://github.com/briheet/Tkgo.git
cd tkgo

# Normal build and run
make

Docker

Tkgo is very easy to use and deploy in a Docker container.

By default, the Docker will expose port 8080, so change this within the Dockerfile if necessary. When ready, simply use the Dockerfile to build the image.

# Enter the project directory
cd Tkgo

# Directly build the image
docker build -t tkgo:multistage -f Dockerfile.multistage .

# Or use Makefile
make docker-build

This will create the Tkgo image and pull in the necessary dependencies.

Once done, run the Docker image and map the port to whatever you wish on your host. For now, we simply map port 8080 of the host to port 8080 of the Docker (or whatever port was exposed in the Dockerfile):

# Directly run the image
docker run -p 8080:8080 tkgo:multistage

# Or use the Makefile
make docker-run

Verify the deployment by navigating to your server address in your preferred browser.

http://localhost:8080/health

Insights

Diagram

Create User Request Body

{
    "userInfo": {
        "userName": "John",
        "userId": "1234"
    },
    "simulationTime": 5,
    "tokenNumbers": 5
}

GetToken Request Body

{
    "userId": "1234"
}

Development

Going on. Want to contribute? Make a pr :)

About

Token Pool for track and token simulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published