tangled
alpha
login
or
join now
stream.place
/
streamplace
74
fork
atom
Live video on the AT Protocol
74
fork
atom
overview
issues
1
pulls
pipelines
spid: move cid and tid handlers into dedicated package
Eli Mallon
6 months ago
bcb1f983
bb37b591
+22
-2
3 changed files
expand all
collapse all
unified
split
pkg
atproto
lexicon_repo.go
spid
cid.go
tid.go
+1
-1
pkg/atproto/get_cid.go
pkg/spid/cid.go
···
1
1
-
package atproto
1
1
+
package spid
2
2
3
3
import (
4
4
"bytes"
+2
-1
pkg/atproto/lexicon_repo.go
···
29
29
"stream.place/streamplace/pkg/config"
30
30
"stream.place/streamplace/pkg/log"
31
31
"stream.place/streamplace/pkg/model"
32
32
+
"stream.place/streamplace/pkg/spid"
32
33
"stream.place/streamplace/pkg/statedb"
33
34
)
34
35
···
247
248
}
248
249
sfw := &SchemaFileWrapper{SchemaFile: lexFile}
249
250
rpath := fmt.Sprintf("com.atproto.lexicon.schema/%s", lexFile.ID)
250
250
-
newCid, err := GetCID(sfw)
251
251
+
newCid, err := spid.GetCID(sfw)
251
252
if err != nil {
252
253
return nil, err
253
254
}
+19
pkg/spid/tid.go
···
1
1
+
package spid
2
2
+
3
3
+
import (
4
4
+
"crypto/rand"
5
5
+
"math/big"
6
6
+
7
7
+
"github.com/bluesky-social/indigo/atproto/syntax"
8
8
+
)
9
9
+
10
10
+
var TIDClock *syntax.TIDClock
11
11
+
12
12
+
func init() {
13
13
+
id, err := rand.Int(rand.Reader, big.NewInt(1024))
14
14
+
if err != nil {
15
15
+
panic(err)
16
16
+
}
17
17
+
clock := syntax.NewTIDClock(uint(id.Uint64()))
18
18
+
TIDClock = &clock
19
19
+
}