Henry Du Blog

think digital, act analog

Golang Decoupling, Embedding and Exporting

Golang Decoupling, Embedding and Exporting Decoupling Golang does not have a concept of object-oriented programming (OOP), including the concept of class or a class-based inheritance. Rather, Golang has its own way to interpret the regular object-oriented languages - decoupling. In traditional OOP design, one class contains member variables, either public or private. It also contains member functions, either public or private. In order to reuse the class member function, another class has to inherit the class.

Using the Kea DHCP Server 4

Using KEA DHCP Webinar part 4 This blog is a study note of using KEA DHCP webinar 04. This webinar introduced backend database and DHCP HA. For DB part, I only took very basic notes. The details of backend database can be available form the slides. Database backend support for Kea Kea DHCP server can store information in a database, including lease info, host address and prefixes, host options, host names and host classification.

Go Channel Patterns

Golang Channel Patterns Golang channel allows us to transfer data structure between go-routine boundaries. It could be zero byte data struct{}{}, served as signaling purpose. In this use case, the channel is semantically a signaling, by which, one go-routine can send a signal to another go-routine, as a notification or an event. Signaling without data serves the main purpose of cancellation. It allows one go-routine to signal another go-routine to cancel the channel.

Go Routine Run as a Thread?

Go Routine Run as a Thread? Whether or not a go-routine run as a machine thread is always a question for me, until I finally have a chance to inspect it by gdb. First, We could write a simple go code to have a go func(). package main import ( "fmt" "time" ) func main() { ch := make(chan string) go func() { fmt.Println(fmt.Sprintf("received the data '%v' from the channel", <-ch)) }() fmt.

Running A Simple Operator in Minikube

Running A Simple Operator in Minikube Introduction You may have heard of Kubernetes operator pattern. Maybe you have worked on one of projects that has Custom Resource Definition (CRD). Custom resource definitions are cool things once you define your custom resource on Kubernetes by using YAML. The Kubernetes API server component will implement CRUD API for you automatically. Then, you can use powerful Kubernetes clients, such as kubectl to interact with your own resources managed by Kubernetes.