Files
CHORUS/vendor/github.com/polydawn/refmt/cbor/cborEncoderTerminals.go
anthonyrawlins 9bdcbe0447 Integrate BACKBEAT SDK and resolve KACHING license validation
Major integrations and fixes:
- Added BACKBEAT SDK integration for P2P operation timing
- Implemented beat-aware status tracking for distributed operations
- Added Docker secrets support for secure license management
- Resolved KACHING license validation via HTTPS/TLS
- Updated docker-compose configuration for clean stack deployment
- Disabled rollback policies to prevent deployment failures
- Added license credential storage (CHORUS-DEV-MULTI-001)

Technical improvements:
- BACKBEAT P2P operation tracking with phase management
- Enhanced configuration system with file-based secrets
- Improved error handling for license validation
- Clean separation of KACHING and CHORUS deployment stacks

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 07:56:26 +10:00

78 lines
1.9 KiB
Go

package cbor
import (
"encoding/binary"
"math"
)
func (d *Encoder) emitLen(majorByte byte, length int) {
d.emitMajorPlusLen(majorByte, uint64(length))
}
func (d *Encoder) emitMajorPlusLen(majorByte byte, v uint64) {
if v <= 0x17 {
d.w.writen1(majorByte + byte(v))
} else if v <= math.MaxUint8 {
d.w.writen2(majorByte+0x18, uint8(v))
} else if v <= math.MaxUint16 {
d.w.writen1(majorByte + 0x19)
d.spareBytes = d.spareBytes[:2]
binary.BigEndian.PutUint16(d.spareBytes, uint16(v))
d.w.writeb(d.spareBytes)
} else if v <= math.MaxUint32 {
d.w.writen1(majorByte + 0x1a)
d.spareBytes = d.spareBytes[:4]
binary.BigEndian.PutUint32(d.spareBytes, uint32(v))
d.w.writeb(d.spareBytes)
} else { // if v <= math.MaxUint64 {
d.w.writen1(majorByte + 0x1b)
d.spareBytes = d.spareBytes[:8]
binary.BigEndian.PutUint64(d.spareBytes, v)
d.w.writeb(d.spareBytes)
}
}
func (d *Encoder) encodeNull() {
d.w.writen1(cborSigilNil)
}
func (d *Encoder) encodeString(s string) {
d.emitMajorPlusLen(cborMajorString, uint64(len(s)))
d.w.writestr(s)
}
func (d *Encoder) encodeBytes(bs []byte) {
d.emitMajorPlusLen(cborMajorBytes, uint64(len(bs)))
d.w.writeb(bs)
}
func (d *Encoder) encodeBool(b bool) {
if b {
d.w.writen1(cborSigilTrue)
} else {
d.w.writen1(cborSigilFalse)
}
}
func (d *Encoder) encodeInt64(v int64) {
if v >= 0 {
d.emitMajorPlusLen(cborMajorUint, uint64(v))
} else {
d.emitMajorPlusLen(cborMajorNegInt, uint64(-1-v))
}
}
func (d *Encoder) encodeUint64(v uint64) {
d.emitMajorPlusLen(cborMajorUint, v)
}
func (d *Encoder) encodeFloat64(v float64) {
// Can we pack it into 32? No idea: float precision is fraught with peril.
// See https://play.golang.org/p/u9sN6x0kk6
// So we *only* emit the full 64-bit style. The CBOR spec permits this.
d.w.writen1(cborSigilFloat64)
d.spareBytes = d.spareBytes[:8]
binary.BigEndian.PutUint64(d.spareBytes, math.Float64bits(v))
d.w.writeb(d.spareBytes)
}