代码拉取完成,页面将自动刷新
/*
Copyright 2019 yametech.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package canal
import (
"io"
)
type ByteReader interface {
io.Reader
// io.ByteReader
io.ByteScanner
}
type OffsetHandler interface {
Increment(int64)
Offset() string
}
type CommandDecoder interface {
Command(cmd *Command) error
}
// A Decodr must be implemented to parse a RDB io.Reader & parse a command io.Reader
type Decoder interface {
// BeginDatabase is called when database n Begins.
// Once a database Begins, another database will not Begin until EndDatabase is called.
BeginDatabase(n int)
// Set is called once for each string key.
Set(key, value []byte, expiry int64)
// BeginHash is called at the beginning of a hash.
// Hset will be called exactly length times before EndHash.
BeginHash(key []byte, length, expiry int64)
// Hset is called once for each field=value pair in a hash.
Hset(key, field, value []byte)
// EndHash is called when there are no more fields in a hash.
EndHash(key []byte)
// BeginSet is called at the beginning of a set.
// Sadd will be called exactly cardinality times before EndSet.
BeginSet(key []byte, cardinality, expiry int64)
// Sadd is called once for each member of a set.
Sadd(key, member []byte)
// EndSet is called when there are no more fields in a set.
EndSet(key []byte)
// BeginStream is called at the beginning of a stream.
// Xadd will be called exactly length times before EndStream.
BeginStream(key []byte, cardinality, expiry int64)
// Xadd is called once for each id in a stream.
Xadd(key, streamID, listpack []byte)
// EndHash is called when there are no more fields in a hash.
EndStream(key []byte)
// BeginList is called at the beginning of a list.
// Rpush will be called exactly length times before EndList.
// If length of the list is not known, then length is -1
BeginList(key []byte, length, expiry int64)
// Rpush is called once for each value in a list.
Rpush(key, value []byte)
// EndList is called when there are no more values in a list.
EndList(key []byte)
// BeginZSet is called at the beginning of a sorted set.
// Zadd will be called exactly cardinality times before EndZSet.
BeginZSet(key []byte, cardinality, expiry int64)
// Zadd is called once for each member of a sorted set.
Zadd(key []byte, score float64, member []byte)
// EndZSet is called when there are no more members in a sorted set.
EndZSet(key []byte)
// EndDatabase is called at the end of a database.
EndDatabase(n int)
RDBDecoder
}
type Closer interface {
io.Closer
}
type RDBDecoder interface {
// BeginRDB is called when parsing of a valid RDB file Begins.
BeginRDB()
// EndRDB is called when parsing of the RDB file is complete.
EndRDB()
// AUX field
Aux(key, value []byte)
// ResizeDB hint
ResizeDatabase(dbSize, expiresSize uint32)
}
// Nop may be embedded in a real Decoder to avoid implementing methods.
type Nop struct{}
func (d Nop) BeginRDB() {}
func (d Nop) BeginDatabase(n int) {}
func (d Nop) Aux(key, value []byte) {}
func (d Nop) ResizeDatabase(dbSize, expiresSize uint32) {}
func (d Nop) EndDatabase(n int) {}
func (d Nop) EndRDB() {}
func (d Nop) Set(key, value []byte, expiry int64) {}
func (d Nop) BeginHash(key []byte, length, expiry int64) {}
func (d Nop) Hset(key, field, value []byte) {}
func (d Nop) EndHash(key []byte) {}
func (d Nop) BeginSet(key []byte, cardinality, expiry int64) {}
func (d Nop) Sadd(key, member []byte) {}
func (d Nop) EndSet(key []byte) {}
func (d Nop) BeginList(key []byte, length, expiry int64) {}
func (d Nop) Rpush(key, value []byte) {}
func (d Nop) EndList(key []byte) {}
func (d Nop) BeginZSet(key []byte, cardinality, expiry int64) {}
func (d Nop) Zadd(key []byte, score float64, member []byte) {}
func (d Nop) EndZSet(key []byte) {}
func (d Nop) BeginStream(key []byte, cardinality, expiry int64) {}
func (d Nop) Xadd(key, id, listpack []byte) {}
func (d Nop) EndStream(key []byte) {}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。