Skip to content

Commit

Permalink
Merge branch 'main' of github.com:drpcorg/chotki
Browse files Browse the repository at this point in the history
  • Loading branch information
gritzko committed Apr 24, 2024
2 parents 5a33109 + 031c191 commit a3e198d
Show file tree
Hide file tree
Showing 35 changed files with 1,242 additions and 37 deletions.
4 changes: 2 additions & 2 deletions chotki.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"github.com/cockroachdb/pebble"
"github.com/cockroachdb/pebble/vfs"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toyqueue"
"github.com/drpcorg/chotki/toytlv"
)

type Packet []byte
Expand Down
2 changes: 1 addition & 1 deletion chotki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/cockroachdb/pebble"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/drpcorg/chotki/toyqueue"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package chotki

import (
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

type Counter64 int64
Expand Down
2 changes: 1 addition & 1 deletion counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package chotki

import (
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion examples/object_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/cockroachdb/pebble"
"github.com/drpcorg/chotki"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

const ExampleName = 1
Expand Down
2 changes: 1 addition & 1 deletion examples/object_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/drpcorg/chotki"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/drpcorg/chotki/toyqueue"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/objects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/drpcorg/chotki"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/drpcorg/chotki/toyqueue"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ go 1.21.4
require (
github.com/cockroachdb/pebble v1.1.0
github.com/ergochat/readline v0.1.0
github.com/learn-decentralized-systems/toyqueue v0.1.5
github.com/learn-decentralized-systems/toytlv v0.2.1
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
)
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/learn-decentralized-systems/toyqueue v0.1.5 h1:X2EQEWj2dyaE5BUkE58aXsMG7mq8Uv6CpiFCErAnCMQ=
github.com/learn-decentralized-systems/toyqueue v0.1.5/go.mod h1:T5PrFDCcxA1O7hb2MAlHYYFA89ry8hvXUuwg+drS1UQ=
github.com/learn-decentralized-systems/toytlv v0.2.1 h1:nk+gjjE9JZ659kkbxIlv/H/gF5Wtst1Dbn7KckqdFOQ=
github.com/learn-decentralized-systems/toytlv v0.2.1/go.mod h1:+xzKS/La5vCkdyIdOFDb2NVPGF808tG5n5b3Ufxkorg=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
Expand Down
4 changes: 2 additions & 2 deletions log0.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package chotki

import (
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toyqueue"
"github.com/drpcorg/chotki/toytlv"
)

const id1 = rdx.ID0 + rdx.ProInc
Expand Down
4 changes: 2 additions & 2 deletions objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"github.com/cockroachdb/pebble"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toyqueue"
"github.com/drpcorg/chotki/toytlv"
"github.com/pkg/errors"
"unicode/utf8"
)
Expand Down
2 changes: 1 addition & 1 deletion op.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package chotki

import (
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

func ParsePacket(pack []byte) (lit byte, id, ref rdx.ID, body []byte, err error) {
Expand Down
2 changes: 1 addition & 1 deletion packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/cockroachdb/pebble"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

func (cho *Chotki) UpdateVTree(id, ref rdx.ID, pb *pebble.Batch) (err error) {
Expand Down
2 changes: 1 addition & 1 deletion rdx/ELM.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rdx
import (
"bytes"
"errors"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
"slices"
"sort"
)
Expand Down
4 changes: 2 additions & 2 deletions rdx/ELM_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package rdx

import (
"github.com/learn-decentralized-systems/toyqueue"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toyqueue"
"github.com/drpcorg/chotki/toytlv"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
4 changes: 2 additions & 2 deletions rdx/FIRST.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"bytes"
"errors"
"fmt"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/drpcorg/chotki/toyqueue"

"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

// Common LWW functions
Expand Down
2 changes: 1 addition & 1 deletion rdx/FIRST_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package rdx
import (
"testing"

"github.com/learn-decentralized-systems/toyqueue"
"github.com/drpcorg/chotki/toyqueue"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion rdx/NZ.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package rdx

import (
"fmt"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

// N is an increment-only uint64 counter
Expand Down
2 changes: 1 addition & 1 deletion rdx/NZ_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rdx

import (
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion rdx/X.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package rdx

import (
hex2 "encoding/hex"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

func Xparse(rdt byte, val string) (tlv []byte) {
Expand Down
2 changes: 1 addition & 1 deletion rdx/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"

"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

/*
Expand Down
2 changes: 1 addition & 1 deletion rdx/rdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package rdx

import (
"errors"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/drpcorg/chotki/toyqueue"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion rdx/vv.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"slices"

"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
)

// VV is a version vector, max ids seen from each known replica.
Expand Down
4 changes: 2 additions & 2 deletions repl/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/cockroachdb/pebble"
"github.com/drpcorg/chotki"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toyqueue"
"github.com/drpcorg/chotki/toytlv"
)

var HelpCreate = errors.New("create zone/1 {Name:\"Name\",Description:\"long text\"}")
Expand Down
2 changes: 1 addition & 1 deletion repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/drpcorg/chotki"
"github.com/drpcorg/chotki/rdx"
"github.com/ergochat/readline"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toytlv"
"io"
"os"
"strings"
Expand Down
4 changes: 2 additions & 2 deletions sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"github.com/cockroachdb/pebble"
"github.com/drpcorg/chotki/rdx"
"github.com/learn-decentralized-systems/toyqueue"
"github.com/learn-decentralized-systems/toytlv"
"github.com/drpcorg/chotki/toyqueue"
"github.com/drpcorg/chotki/toytlv"
"io"
"os"
"sync"
Expand Down
65 changes: 65 additions & 0 deletions toyqueue/drainfeed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package toyqueue

import "io"

// Records (a batch of) as a very universal primitive, especially
// for database/network op/packet processing. Batching allows
// for writev() and other performance optimizations. ALso, if
// you have cryptography, blobs are way handier than structs.
// Records converts easily to net.Buffers.
type Records [][]byte

type Feeder interface {
// Feed reads and returns records.
// The EoF convention follows that of io.Reader:
// can either return `records, EoF` or
// `records, nil` followed by `nil/{}, EoF`
Feed() (recs Records, err error)
}

type FeedCloser interface {
Feeder
io.Closer
}

type FeedSeeker interface {
Feeder
io.Seeker
}

type FeedSeekCloser interface {
Feeder
io.Seeker
io.Closer
}

type Drainer interface {
Drain(recs Records) error
}

type DrainSeeker interface {
Drainer
io.Seeker
}

type DrainCloser interface {
Drainer
io.Closer
}

type DrainSeekCloser interface {
Drainer
io.Seeker
io.Closer
}

type FeedDrainer interface {
Feeder
Drainer
}

type FeedDrainCloser interface {
Feeder
Drainer
io.Closer
}
Loading

0 comments on commit a3e198d

Please sign in to comment.