Skip to content

wytee64/DSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

131 Commits
 
 
 
 
 
 

Repository files navigation

DSA Ballerina Projects

This repo contains two distributed systems projects built with Ballerina.

Repository Structure

  • question-1 # Asset Management System (REST API)
  • question-2 # Car Rental System (gRPC)

Question 1: Asset Management System (REST API)

Location: question-1/

A REST API for managing university assets, their components, maintenance schedules, and work orders. Uses in-memory storage with Ballerina’s HTTP module.

Architecture

  • Language: Ballerina
  • Protocol: REST (HTTP)
  • Port: 8080 (Service)
  • Storage: In-memory map

Features

  • CRUD operations for assets (add, update, delete, view)
  • Component tracking for each asset
  • Maintenance scheduling (weekly, monthly, yearly)
  • Handle work orders and tasks
  • Faculty-based filtering
  • In-memory storage

API Endpoints

Method Endpoint Description
POST /assets/addAsset Add a new asset
GET /assets/getAsset/{assetTag} Get asset by tag
PUT /assets/updateAsset/{assetTag} Update asset
DELETE /assets/removeAsset/{assetTag} Delete asset
GET /assets/faculty/{faculty} List assets by faculty
POST /assets/{tag}/components Add a component
GET /assets/{tag}/components List components
PUT /assets/{tag}/components/{componentId} Update component
DELETE /assets/{tag}/components/{componentId} Delete component
POST /assets/{tag}/workorders Add a work order
GET /assets/{tag}/workorders Get all work orders
PUT /assets/{tag}/workorders/{woID} Update work order
POST /assets/{tag}/workorders/{woID}/tasks Add a task
GET /assets/{tag}/workorders/{woID}/tasks Get all tasks
DELETE /assets/{tag}/workorders/{woID}/tasks Delete task

Data Models

  • Asset: Metadata about university assets
  • Component: Parts of an asset
  • Maintenance: Scheduled maintenance records
  • WorkOrder: Maintenance work orders
  • Task: Tasks within work orders

Question 2: Car Rental System (gRPC)

Location: question-2/

A distributed car rental system using gRPC. Supports real-time car management, user authentication, shopping carts, and reservations.

Architecture

  • Protocol: gRPC (HTTP/2)
  • Port: 9090
  • Communication: Asynchronous, bidirectional streaming
  • Data Format: Protocol Buffers

Features

  • Car management: add, update, remove, search
  • User management via client streaming
  • Real-time search for available cars
  • Shopping cart system
  • Reservation workflow
  • Streaming support for real-time updates

gRPC Methods

Method Type Description
add_car Unary Add a car to inventory
update_car Unary Update car info
remove_car Unary Delete a car
search_car Unary Find a specific car
list_available_cars Server Streaming Stream available cars
add_to_cart Unary Add car to cart
place_reservation Unary Make a reservation
create_users Client Streaming Batch user creation

Data Models

  • Car: Vehicle details (plate, make, model, price)
  • User: Customer/Admin profiles
  • CartItem: Items in shopping cart
  • Reservation: Full booking record

Tech Stack

Common

  • Language: Ballerina
  • Build Tool: Ballerina CLI
  • IDE: VS Code + Ballerina extension

Question 1

  • Ballerina HTTP module

Question 2

  • Ballerina gRPC module
  • Protocol Buffers
  • Bidirectional streaming

About

gRPC and REST API

Topics

Resources

Stars

Watchers

Forks

Contributors