Skip to content

broganross/salad-interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Technical Project for Salad Technologies

Original problem description is found here: https://saladtech.notion.site/Salad-s-Technical-Interview-2e7e8c19c4284c61975fd3d4eba3bfbe

Configuration

Configuration is managed with the following environment variables

SALAD_MESSAGEROUTER_URL

  The URL for the message router.

Example: data.salad.com:5000

Default:

Required: Yes

SALAD_MESSAGEROUTER_TCPTIMEOUT

  Timeout control for open TCP connections. If set to 0, no timeout is set

Example: 30s

Default: 1m

Required: No

SALAD_MESSAGEROUTER_MAXRETRY

  Maximum number of times to try opening a connection to the server before exiting.   -1 means there's no maximum.

Example: 10

Default: 5

Required: No

SALAD_MESSAGEROUTER_RETRYSLEEP

  The starting duration to wait between retrying TCP connections. This value will increase exponentially for each retry.

Example: 3s

Default: 1s

Required: No

SALAD_LOG_LEVEL

  Level for the logger   Available log level values are as follows:

  • Debug: 0
  • Info: 1
  • Warn: 2
  • Error: 3
  • Fatal: 4
  • Panic: 5

Example: 2

Default: 1

Required: No

Execute Unit Tests

go test ./...

Build

go build ./cmd/processor/main.go

Run

go run ./cmd/processor/main.go

Get Started

For just checking out the functionality first start up the server:

go run ./cmd/server/main.go

Then set your server URL and run the processor:

# linux
SALAD_MESSAGEROUTER_URL=127.0.0.1:5000 go run ./cmd/processor/main.go

# powershell
$env:SALAD_MESSAGEROUTER_URL="127.0.0.1:5000"; go run ./cmd/processor/main.go

Notes

  1. The problem says the float64 fields have a size of 4 bytes. This obviously doesn't work, but the example does contain enough bytes.
  2. I made a simple TCP server which just gives a valid response. It can be run using: go run ./cmd/server/main.go. Then set the SALAD_MESSAGEROUTER_URL environment variable to 127.0.0.1:5000.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages