Sobes.tech

What is the difference between a B-tree index and a hash index in PostgreSQL? What other indexes do you know?

289

How to technically implement the OpenAPI specification? What is Swagger?

243

Tell me about Docker: main principles of operation, multistage builds, CLI commands

237

// task 2 // 1. OpenAPI + gRPC // (YAML) // info: // title: Book API // version: .. // paths: // /books: // get: // responses: // "200"

224

What do you know about the runtime package? What methods have you used?

218

What other synchronization primitives, besides mutex and WaitGroup, do you know? Use cases?

213

Tell me about the Transactional Outbox pattern — what is it and why is it used?

208

// mkdir project // cd project // go mod init project // touch main.go // vim main.go // --создаем код-- package main import "syscall" // func main() { // msg := []byte("Hello, World!\n") // syscall.Write(1, msg) // } // --код завершен-- // go build -o app // ./app // go test ./... // git nint // git add . // git commit -m "init"

206

What do you know about Transactional Outbox and Saga? Share a practical case.

200

What are the main artifacts of DDD? What parts does it consist of?

198

func main() { ctx := context.Background() urls := []string{ "vk.ru", "ozon.ru", "pi.zone.ru", "lamoda.ru", "adidas.com", } pingMap, err := collectRTT(ctx, urls) if err != nil { fmt.Println("ERR:", err) return } data, _ := json.Marshal(pingMap) fmt.Println("RTT:", string(data)) } func collectRTT(ctx context.Context, urls []string) (map[string]time.Duration, error) { pingMap := make(map[string]time.Duration, len(urls)) var mu sync.Mutex var wg sync.WaitGroup errCh := make(chan error, 1) for _, url := range urls { wg.Add(1) go func(u string) { // ... (rest of the function implementation) }(url) } // ... (rest of the function implementation) } Ошибка: # command-line-arguments 2486763/main.go:34:9: undefined: sync 2486763/main.go:35:9: undefined: sync 2486763/main.go:45:32: undefined: fmt.Errorf

197

Tell me about the monitoring setup: metric collectors, alerts

191

func collectRTT(ctx context.Context, urls []string) (map[string]time.Duration, error) { pingMap := make(map[string]time.Duration, len(urls)) var mu sync.Mutex var wg sync.WaitGroup errCh := make(chan error, 1) for _, url := range urls { wg.Add(1) go func(u string) { defer wg.Done() dur, err := rtt(ctx, u) if err != nil { select { case errCh <- fmt.Errorf("failed to rtt %s, %w", u, err): default: } return } mu.Lock() pingMap[u] = dur mu.Unlock() }(url) } wg.Wait() close(errCh) if err := <-errCh; err != nil { return nil, err } return pingMap, nil }

179
/2