MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / DecodeMysqlGTIDSet

Function DecodeMysqlGTIDSet

IceFireDB-SQLite/pkg/mysql/mysql/mysql_gtid.go:324–347  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

322}
323
324func DecodeMysqlGTIDSet(data []byte) (*MysqlGTIDSet, error) {
325 s := new(MysqlGTIDSet)
326
327 if len(data) < 8 {
328 return nil, errors.Errorf("invalid gtid set buffer, less 4")
329 }
330
331 n := int(binary.LittleEndian.Uint64(data))
332 s.Sets = make(map[string]*UUIDSet, n)
333
334 pos := 8
335
336 for i := 0; i < n; i++ {
337 set := new(UUIDSet)
338 if n, err := set.decode(data[pos:]); err != nil {
339 return nil, errors.Trace(err)
340 } else {
341 pos += n
342
343 s.AddSet(set)
344 }
345 }
346 return s, nil
347}
348
349func (s *MysqlGTIDSet) AddSet(set *UUIDSet) {
350 if set == nil {

Callers 1

TestMysqlGTIDCodecMethod · 0.70

Calls 2

decodeMethod · 0.45
AddSetMethod · 0.45

Tested by 1

TestMysqlGTIDCodecMethod · 0.56