
This commit includes updates that affects the build, testing, and deployment of Tile38. - The root level build.sh has been broken up into multiple scripts and placed in the "scripts" directory. - The vendor directory has been updated to follow the Go modules rules, thus `make` should work on isolated environments. Also some vendored packages may have been updated to a later version, if needed. - The Makefile has been updated to allow for making single binaries such as `make tile38-server`. There is some scaffolding during the build process, so from now on all binaries should be made using make. For example, to run a development version of the tile38-cli binary, do this: make tile38-cli && ./tile38-cli not this: go run cmd/tile38-cli/main.go - Travis.CI docker push script has been updated to address a change to Docker's JSON repo meta output, which in turn fixes a bug where new Tile38 versions were not being properly pushed to Docker
46 lines
1.7 KiB
Go
46 lines
1.7 KiB
Go
package sarama
|
|
|
|
// PacketDecoder is the interface providing helpers for reading with Kafka's encoding rules.
|
|
// Types implementing Decoder only need to worry about calling methods like GetString,
|
|
// not about how a string is represented in Kafka.
|
|
type packetDecoder interface {
|
|
// Primitives
|
|
getInt8() (int8, error)
|
|
getInt16() (int16, error)
|
|
getInt32() (int32, error)
|
|
getInt64() (int64, error)
|
|
getArrayLength() (int, error)
|
|
|
|
// Collections
|
|
getBytes() ([]byte, error)
|
|
getString() (string, error)
|
|
getInt32Array() ([]int32, error)
|
|
getInt64Array() ([]int64, error)
|
|
getStringArray() ([]string, error)
|
|
|
|
// Subsets
|
|
remaining() int
|
|
getSubset(length int) (packetDecoder, error)
|
|
|
|
// Stacks, see PushDecoder
|
|
push(in pushDecoder) error
|
|
pop() error
|
|
}
|
|
|
|
// PushDecoder is the interface for decoding fields like CRCs and lengths where the validity
|
|
// of the field depends on what is after it in the packet. Start them with PacketDecoder.Push() where
|
|
// the actual value is located in the packet, then PacketDecoder.Pop() them when all the bytes they
|
|
// depend upon have been decoded.
|
|
type pushDecoder interface {
|
|
// Saves the offset into the input buffer as the location to actually read the calculated value when able.
|
|
saveOffset(in int)
|
|
|
|
// Returns the length of data to reserve for the input of this encoder (eg 4 bytes for a CRC32).
|
|
reserveLength() int
|
|
|
|
// Indicates that all required data is now available to calculate and check the field.
|
|
// SaveOffset is guaranteed to have been called first. The implementation should read ReserveLength() bytes
|
|
// of data from the saved offset, and verify it based on the data between the saved offset and curOffset.
|
|
check(curOffset int, buf []byte) error
|
|
}
|