forked from mirror/redcon
fix paths
This commit is contained in:
parent
bc9875b4b0
commit
1a6a9a352c
|
@ -3,7 +3,7 @@
|
|||
src="logo.png"
|
||||
width="336" border="0" alt="REDCON">
|
||||
<br>
|
||||
<a href="https://godoc.org/github.com/tidwall/redcon"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
||||
<a href="https://godoc.org/git.internal/re/redcon"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">Redis compatible server framework for Go</p>
|
||||
|
@ -22,7 +22,7 @@ Installing
|
|||
----------
|
||||
|
||||
```
|
||||
go get -u github.com/tidwall/redcon
|
||||
go get -u git.internal/re/redcon
|
||||
```
|
||||
|
||||
Example
|
||||
|
@ -52,7 +52,7 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/tidwall/redcon"
|
||||
"git.internal/re/redcon"
|
||||
)
|
||||
|
||||
var addr = ":6380"
|
||||
|
|
|
@ -5,14 +5,14 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/tidwall/redcon"
|
||||
"git.internal/re/redcon"
|
||||
)
|
||||
|
||||
var addr = ":6380"
|
||||
|
||||
func main() {
|
||||
var mu sync.RWMutex
|
||||
var items = make(map[string][]byte)
|
||||
items := make(map[string][]byte)
|
||||
var ps redcon.PubSub
|
||||
go log.Printf("started server at %s", addr)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"log"
|
||||
|
||||
"github.com/tidwall/redcon"
|
||||
"git.internal/re/redcon"
|
||||
)
|
||||
|
||||
var addr = ":6380"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/tidwall/redcon"
|
||||
"git.internal/re/redcon"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/tidwall/redcon"
|
||||
"git.internal/re/redcon"
|
||||
)
|
||||
|
||||
const serverKey = `-----BEGIN EC PARAMETERS-----
|
||||
|
@ -44,7 +44,7 @@ func main() {
|
|||
config := &tls.Config{Certificates: []tls.Certificate{cer}}
|
||||
|
||||
var mu sync.RWMutex
|
||||
var items = make(map[string][]byte)
|
||||
items := make(map[string][]byte)
|
||||
|
||||
go log.Printf("started server at %s", addr)
|
||||
err = redcon.ListenAndServeTLS(addr,
|
||||
|
|
4
go.mod
4
go.mod
|
@ -1,6 +1,6 @@
|
|||
module github.com/tidwall/redcon
|
||||
module git.internal/re/redcon
|
||||
|
||||
go 1.15
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/tidwall/btree v1.1.0
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
git.internal/re/redcon,Unknown,MIT
|
||||
github.com/tidwall/btree,https://github.com/tidwall/btree/blob/v1.1.0/LICENSE,MIT
|
||||
github.com/tidwall/match,https://github.com/tidwall/match/blob/v1.1.1/LICENSE,MIT
|
43
redcon.go
43
redcon.go
|
@ -296,7 +296,9 @@ func (s *Server) ListenServeAndSignal(signal chan error) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
s.mu.Lock()
|
||||
s.ln = ln
|
||||
s.mu.Unlock()
|
||||
if signal != nil {
|
||||
signal <- nil
|
||||
}
|
||||
|
@ -321,7 +323,9 @@ func (s *TLSServer) ListenServeAndSignal(signal chan error) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
s.mu.Lock()
|
||||
s.ln = ln
|
||||
s.mu.Unlock()
|
||||
if signal != nil {
|
||||
signal <- nil
|
||||
}
|
||||
|
@ -350,7 +354,7 @@ func serve(s *Server) error {
|
|||
return nil
|
||||
}
|
||||
if errors.Is(err, net.ErrClosed) {
|
||||
// see https://github.com/tidwall/redcon/issues/46
|
||||
// see https://git.internal/re/redcon/issues/46
|
||||
return nil
|
||||
}
|
||||
if s.AcceptError != nil {
|
||||
|
@ -480,9 +484,11 @@ func (c *conn) ReadPipeline() []Command {
|
|||
c.cmds = nil
|
||||
return cmds
|
||||
}
|
||||
|
||||
func (c *conn) PeekPipeline() []Command {
|
||||
return c.cmds
|
||||
}
|
||||
|
||||
func (c *conn) NetConn() net.Conn {
|
||||
return c.conn
|
||||
}
|
||||
|
@ -602,9 +608,9 @@ func (w *Writer) WriteNull() {
|
|||
// sub-responses to the client to complete the response.
|
||||
// For example to write two strings:
|
||||
//
|
||||
// c.WriteArray(2)
|
||||
// c.WriteBulkString("item 1")
|
||||
// c.WriteBulkString("item 2")
|
||||
// c.WriteArray(2)
|
||||
// c.WriteBulkString("item 1")
|
||||
// c.WriteBulkString("item 2")
|
||||
func (w *Writer) WriteArray(count int) {
|
||||
if w.err != nil {
|
||||
return
|
||||
|
@ -709,17 +715,18 @@ func (w *Writer) WriteRaw(data []byte) {
|
|||
}
|
||||
|
||||
// WriteAny writes any type to client.
|
||||
// nil -> null
|
||||
// error -> error (adds "ERR " when first word is not uppercase)
|
||||
// string -> bulk-string
|
||||
// numbers -> bulk-string
|
||||
// []byte -> bulk-string
|
||||
// bool -> bulk-string ("0" or "1")
|
||||
// slice -> array
|
||||
// map -> array with key/value pairs
|
||||
// SimpleString -> string
|
||||
// SimpleInt -> integer
|
||||
// everything-else -> bulk-string representation using fmt.Sprint()
|
||||
//
|
||||
// nil -> null
|
||||
// error -> error (adds "ERR " when first word is not uppercase)
|
||||
// string -> bulk-string
|
||||
// numbers -> bulk-string
|
||||
// []byte -> bulk-string
|
||||
// bool -> bulk-string ("0" or "1")
|
||||
// slice -> array
|
||||
// map -> array with key/value pairs
|
||||
// SimpleString -> string
|
||||
// SimpleInt -> integer
|
||||
// everything-else -> bulk-string representation using fmt.Sprint()
|
||||
func (w *Writer) WriteAny(v interface{}) {
|
||||
if w.err != nil {
|
||||
return
|
||||
|
@ -1020,7 +1027,6 @@ func Parse(raw []byte) (Command, error) {
|
|||
return Command{}, errTooMuchData
|
||||
}
|
||||
return cmds[0], nil
|
||||
|
||||
}
|
||||
|
||||
// A Handler responds to an RESP request.
|
||||
|
@ -1105,6 +1111,11 @@ func (ps *PubSub) Psubscribe(conn Conn, channel string) {
|
|||
ps.subscribe(conn, true, channel)
|
||||
}
|
||||
|
||||
// Unsubscribe a connection from PubSub
|
||||
func (ps *PubSub) Unsubscribe(conn Conn, pattern, all bool, channel string) {
|
||||
ps.unsubscribe(conn, pattern, all, channel)
|
||||
}
|
||||
|
||||
// Publish a message to subscribers
|
||||
func (ps *PubSub) Publish(channel, message string) int {
|
||||
ps.mu.RLock()
|
||||
|
|
Loading…
Reference in New Issue