Working from home means we need to self-manage a lot of things, from being our own IT people to getting our own food, to making our own coffee. Coffee is critical infra, so let us treat it as such, with a coffee service architecture. But it is not highly available. How do we make it highly available?
23. ./coffee.go:15:42: cannot use e (type *energy.Gas) as type coffeemachine.Electricity
in argument to coffeemachine.NewDelonghiMagnificaS:
*energy.Gas does not implement coffeemachine.Electricity (missing GetElectricity
method)
High Availability (HA) Coffee
@Heathenaspargus
Compile error
25. ./coffee.go:15:32: cannot use e (type *energy.Gas) as type coffeemachine.Heat in
argument to coffeemachine.NewBialetti:
*energy.Gas does not implement coffeemachine.Heat (missing GetHeat method)
High Availability (HA) Coffee
@Heathenaspargus
26. Current Coffee Architecture
High Availability (HA) Coffee
Backend +
Cache
Backend
Backend
Frontend Client
Cache
Cache
Translation
layer
@Heathenaspargus
27. type Stove struct {
g gas
}
type gas interface {
GetGas()
}
func (s *Stove) GetHeat() {
fmt.Printf("Heating up...n")
time.Sleep(1 * time.Second)
}
func NewStove(g gas) *Stove {
return &Stove{g: g}
}
High Availability (HA) Coffee
@Heathenaspargus
30. Takeaways
— If you don’t plan for HA, you will have to refactor later
High Availability (HA) Coffee
@Heathenaspargus
31. Takeaways
— If you don’t plan for HA, you will have to refactor later
— Refactoring can add functionality
High Availability (HA) Coffee
@Heathenaspargus
32. Takeaways
— If you don’t plan for HA, you will have to refactor later
— Refactoring can add functionality
— Invest in good coffee
High Availability (HA) Coffee
@Heathenaspargus