forked from forgejo/forgejo
[Vendor] update macaron related (#13409)
* Vendor: update gitea.com/macaron/session to a177a270 * make vendor * Vendor: update gitea.com/macaron/macaron to 0db5d458 * make vendor * Vendor: update gitea.com/macaron/cache to 905232fb * make vendor * Vendor: update gitea.com/macaron/i18n to 4ca3dd0c * make vendor * Vendor: update gitea.com/macaron/gzip to efa5e847 * make vendor * Vendor: update gitea.com/macaron/captcha to e8597820 * make vendor
This commit is contained in:
parent
b687707014
commit
70ea2300ca
118 changed files with 14557 additions and 6115 deletions
67
vendor/github.com/couchbase/gomemcached/client/upr_feed.go
generated
vendored
67
vendor/github.com/couchbase/gomemcached/client/upr_feed.go
generated
vendored
|
@ -20,9 +20,11 @@ const uprDeletetionExtraLen = 18
|
|||
const uprDeletetionWithDeletionTimeExtraLen = 21
|
||||
const uprSnapshotExtraLen = 20
|
||||
const dcpSystemEventExtraLen = 13
|
||||
const dcpSeqnoAdvExtraLen = 8
|
||||
const bufferAckThreshold = 0.2
|
||||
const opaqueOpen = 0xBEAF0001
|
||||
const opaqueFailover = 0xDEADBEEF
|
||||
const opaqueGetSeqno = 0xDEADBEEF
|
||||
const uprDefaultNoopInterval = 120
|
||||
|
||||
// Counter on top of opaqueOpen that others can draw from for open and control msgs
|
||||
|
@ -605,44 +607,6 @@ func (feed *UprFeed) uprOpen(name string, sequence uint32, bufSize uint32, featu
|
|||
return
|
||||
}
|
||||
|
||||
// UprGetFailoverLog for given list of vbuckets.
|
||||
func (mc *Client) UprGetFailoverLog(
|
||||
vb []uint16) (map[uint16]*FailoverLog, error) {
|
||||
|
||||
rq := &gomemcached.MCRequest{
|
||||
Opcode: gomemcached.UPR_FAILOVERLOG,
|
||||
Opaque: opaqueFailover,
|
||||
}
|
||||
|
||||
var allFeaturesDisabled UprFeatures
|
||||
if err := doUprOpen(mc, "FailoverLog", 0, allFeaturesDisabled); err != nil {
|
||||
return nil, fmt.Errorf("UPR_OPEN Failed %s", err.Error())
|
||||
}
|
||||
|
||||
failoverLogs := make(map[uint16]*FailoverLog)
|
||||
for _, vBucket := range vb {
|
||||
rq.VBucket = vBucket
|
||||
if err := mc.Transmit(rq); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res, err := mc.Receive()
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to receive %s", err.Error())
|
||||
} else if res.Opcode != gomemcached.UPR_FAILOVERLOG || res.Status != gomemcached.SUCCESS {
|
||||
return nil, fmt.Errorf("unexpected #opcode %v", res.Opcode)
|
||||
}
|
||||
|
||||
flog, err := parseFailoverLog(res.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse failover logs for vb %d", vb)
|
||||
}
|
||||
failoverLogs[vBucket] = flog
|
||||
}
|
||||
|
||||
return failoverLogs, nil
|
||||
}
|
||||
|
||||
// UprRequestStream for a single vbucket.
|
||||
func (feed *UprFeed) UprRequestStream(vbno, opaqueMSB uint16, flags uint32,
|
||||
vuuid, startSequence, endSequence, snapStart, snapEnd uint64) error {
|
||||
|
@ -793,7 +757,6 @@ func (feed *UprFeed) StartFeedWithConfig(datachan_len int) error {
|
|||
}
|
||||
|
||||
func parseFailoverLog(body []byte) (*FailoverLog, error) {
|
||||
|
||||
if len(body)%16 != 0 {
|
||||
err := fmt.Errorf("invalid body length %v, in failover-log", len(body))
|
||||
return nil, err
|
||||
|
@ -808,6 +771,24 @@ func parseFailoverLog(body []byte) (*FailoverLog, error) {
|
|||
return &log, nil
|
||||
}
|
||||
|
||||
func parseGetSeqnoResp(body []byte) (*VBSeqnos, error) {
|
||||
// vbno of 2 bytes + seqno of 8 bytes
|
||||
var entryLen int = 10
|
||||
|
||||
if len(body)%entryLen != 0 {
|
||||
err := fmt.Errorf("invalid body length %v, in getVbSeqno", len(body))
|
||||
return nil, err
|
||||
}
|
||||
vbSeqnos := make(VBSeqnos, len(body)/entryLen)
|
||||
for i, j := 0, 0; i < len(body); i += entryLen {
|
||||
vbno := binary.BigEndian.Uint16(body[i : i+2])
|
||||
seqno := binary.BigEndian.Uint64(body[i+2 : i+10])
|
||||
vbSeqnos[j] = [2]uint64{uint64(vbno), seqno}
|
||||
j++
|
||||
}
|
||||
return &vbSeqnos, nil
|
||||
}
|
||||
|
||||
func handleStreamRequest(
|
||||
res *gomemcached.MCResponse,
|
||||
headerBuf []byte,
|
||||
|
@ -987,6 +968,14 @@ loop:
|
|||
break loop
|
||||
}
|
||||
event = makeUprEvent(pkt, stream, bytes)
|
||||
case gomemcached.UPR_FAILOVERLOG:
|
||||
logging.Infof("Failover log for vb %d received: %v", vb, pkt)
|
||||
case gomemcached.DCP_SEQNO_ADV:
|
||||
if stream == nil {
|
||||
logging.Infof("Stream not found for vb %d: %#v", vb, pkt)
|
||||
break loop
|
||||
}
|
||||
event = makeUprEvent(pkt, stream, bytes)
|
||||
default:
|
||||
logging.Infof("Recived an unknown response for vbucket %d", vb)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue