Go SDK
Будучи скромным гофером хочу отметить, что решение тех или иных задач - требует понимание базы и идиом языка. Конечно, есть замечательная документация, есть не менее замечательный хаб, но пока самые-самые сердечки это репозитория go, где в центре внимания легендарный пакет runtime и sync.
Вот несколько примеров, как описан sync.Map в коде, комментарии к которому и реализация методов отвечает на многие вопросы
//... // Load, LoadAndDelete, LoadOrStore, Swap, CompareAndSwap, and CompareAndDelete // are read operations; Delete, LoadAndDelete, Store, and Swap are write operations; // LoadOrStore is a write operation when it returns loaded set to false; // CompareAndSwap is a write operation when it returns swapped set to true; // and CompareAndDelete is a write operation when it returns deleted set to true. type Map struct {
//... // Range may be O(N) with the number of elements in the map even if f returns // false after a constant number of calls. func (m *Map) Range(f func(key, value any) bool) { // We need to be able to iterate over all of the keys that were already // present at the start of the call to Range. // If read.amended is false, then read.m satisfies that property without // requiring us to hold m.mu for a long time. read := m.loadReadOnly() if read.amended { // m.dirty contains keys not in read.m. Fortunately, Range is already O(N) // (assuming the caller does not break out early)... ...
Всем приятного копания базы и профессионального роста.














