Skip to content

lvmartinez/tdd-php-allocation-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

TDD using PHP: SERVER HOST ALLOCATION TRACKER

Server names consist of an alphabetic host type (e.g. "apibox") concatenated with the server number, with server numbers allocated as before (so "apibox1", "apibox2", etc. are valid hostnames). Write a name tracking class with two operations, allocate(host_type) and deallocate(hostname). The former should reserve and return the next available hostname, while the latter should release that hostname back into the pool.

tracker = Tracker.new()

tracker.allocate("apibox")

"apibox1"

tracker.allocate("apibox")

"apibox2"

tracker.deallocate("apibox1")

nil

tracker.allocate("apibox")

"apibox1"

tracker.allocate("sitebox")

"sitebox1"

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages