coffeshop

package
v0.0.0-...-223ad3b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateClosed = State(iota)
	StateOpen
	StateFinalizing
)
View Source
const (
	CoffeeEspresso  = CoffeeKind("espresso")
	CoffeeLungo     = CoffeeKind("lungo")
	CoffeeCafeLatte = CoffeeKind("cafe-latte")
	CoffeeCappucino = CoffeeKind("cappuccino")
	CofeeFlatWhite  = CoffeeKind("flat-white")
)
View Source
const (
	ExtraShot          = Extra("shot")
	ExtraCinnamon      = Extra("cinnamon")
	ExtraBaileys       = Extra("baileys")
	ExtraCondencedMilk = Extra("condenced-milk")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Coffee

type Coffee struct {
	Kind   CoffeeKind
	Extras []Extra
}

func (Coffee) Duration

func (c Coffee) Duration() time.Duration

type CoffeeKind

type CoffeeKind string

type CoffeeShop

type CoffeeShop struct {
	// contains filtered or unexported fields
}

func NewCoffeeShop

func NewCoffeeShop(timeScale int) *CoffeeShop

func (*CoffeeShop) Open

func (c *CoffeeShop) Open(ctx context.Context, baristasNum int) error

Open opens a coffeeshop with desired context

func (*CoffeeShop) PlaceOrder

func (c *CoffeeShop) PlaceOrder(ctx context.Context, coffee Coffee) (<-chan Coffee, error)

PlaceOrder allocates one barista to make caller a coffee. The duration of making depends on order complexity

type Extra

type Extra string

type State

type State int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL