bluesky appview implementation using microcosm and other services
server.reddwarf.app
appview
bluesky
reddwarf
microcosm
1package store
2
3import "sync"
4
5type KV struct {
6 mu sync.RWMutex
7 m map[string][]byte
8}
9
10func NewKV() *KV {
11 return &KV{
12 m: make(map[string][]byte),
13 }
14}
15
16func (kv *KV) Get(key string) ([]byte, bool) {
17 kv.mu.RLock()
18 defer kv.mu.RUnlock()
19 v, ok := kv.m[key]
20 return v, ok
21}
22
23func (kv *KV) Set(key string, val []byte) {
24 kv.mu.Lock()
25 defer kv.mu.Unlock()
26 kv.m[key] = val
27}