* [WIP] Torrent Generation on not found error As asked in #1517, it allows on-the-fly torrent generation. Since it uses magnet links, it needs some time to connect to peers. So it can't be instant generation, we need the user to wait and try after a minute at least. * Replace Fatal by simple error * attempt at fixing travis * del * Add Anacrolyx dependency * Add back difflib * Remove .torrent suffix in the url example * Add some explanations when file missing page shown * Ignore downloads directory * Either use cache (third-party site) or own download directory * Wrong import * If there is an error then it means we aren't generating a torrent file May it be "torrent not found" or "We do not store torrent files" which are the two only existing errors for this page * hash is never empty * TorrentLink may be empty at times So we add a /download/:hash link if it is * Update README.md * Made a mistake here, need to check if false * Update en-us.all.json * Update CHANGELOG.md * Torrent file generation can be triggered by click on button if JS enabled * Update download.go * Update download.go * Use c.JSON instead of text/template * Return to default behavior if we don't generate the file * Don't do the query if returned to default behavior * Add "Could not generate torrent file" error * Fix JS condition & lower delay until button updates * Start download automatically once torrent file is generated * Fix torrentFileExists() constantly returning false if external torrent download URL * torrent-view-data is two tables instead of one This allows the removal of useless things without any problem (e.g Website link), but also a better responsibe design since the previous one separated stats after a certain res looking very wonky * CSS changes to go along * Remove useless <b></b> * Update main.css * In torrentFileExists, check if filestorage path exists instead of looking at the domain in torrent link When checking if the file is stored on another server i used to simply check if the domain name was inside the torrent link, but we can straight up check for filestorage length * Fix JS of on-demand stat fetching * ScrapeAge variable accessible through view.jet.html Contains last scraped time in hours, is at -1 is torrent has never been scraped Stats will get updated if it's either at -1 or above 1460 (2 months old) * Refresh stats if older than two months OR unknown and older than 24h Show last scraped date even if stats are unknown * Add StatsObsolete variable to torrent Indicating if: - They can be shown - They need to be updated * Update scraped data even if Unknown, prevent users from trying to fetch stats every seconds * Torrent file stored locally by default * no need to do all of that if no filestorage * fix filestorage path * Fix torrent download button stuck on "Generating torrent file" at rare times * fix some css rules that didn't work on IE * Fix panic error Seems like this error is a known bug from anacrolyx torrent https://github.com/anacrolix/torrent/issues/83 To prevent it, I'm creating a single client and modifying the socket.go to make it not raise a panic but a simple error log.
1118 lignes
23 Kio
Go
1118 lignes
23 Kio
Go
package roaring
|
|
|
|
// NOTE: THIS FILE WAS PRODUCED BY THE
|
|
// MSGP CODE GENERATION TOOL (github.com/tinylib/msgp)
|
|
// DO NOT EDIT
|
|
|
|
import "github.com/tinylib/msgp/msgp"
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *addHelper32) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zbai uint32
|
|
zbai, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zbai > 0 {
|
|
zbai--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "runstart":
|
|
z.runstart, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "runlen":
|
|
z.runlen, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "actuallyAdded":
|
|
z.actuallyAdded, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "m":
|
|
var zcmr uint32
|
|
zcmr, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap(z.m) >= int(zcmr) {
|
|
z.m = (z.m)[:zcmr]
|
|
} else {
|
|
z.m = make([]interval32, zcmr)
|
|
}
|
|
for zxvk := range z.m {
|
|
var zajw uint32
|
|
zajw, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zajw > 0 {
|
|
zajw--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.m[zxvk].start, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.m[zxvk].last, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case "rc":
|
|
if dc.IsNil() {
|
|
err = dc.ReadNil()
|
|
if err != nil {
|
|
return
|
|
}
|
|
z.rc = nil
|
|
} else {
|
|
if z.rc == nil {
|
|
z.rc = new(runContainer32)
|
|
}
|
|
var zwht uint32
|
|
zwht, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zwht > 0 {
|
|
zwht--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "iv":
|
|
var zhct uint32
|
|
zhct, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap(z.rc.iv) >= int(zhct) {
|
|
z.rc.iv = (z.rc.iv)[:zhct]
|
|
} else {
|
|
z.rc.iv = make([]interval32, zhct)
|
|
}
|
|
for zbzg := range z.rc.iv {
|
|
var zcua uint32
|
|
zcua, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zcua > 0 {
|
|
zcua--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.rc.iv[zbzg].start, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.rc.iv[zbzg].last, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case "card":
|
|
z.rc.card, err = dc.ReadInt64()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *addHelper32) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 5
|
|
// write "runstart"
|
|
err = en.Append(0x85, 0xa8, 0x72, 0x75, 0x6e, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.runstart)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "runlen"
|
|
err = en.Append(0xa6, 0x72, 0x75, 0x6e, 0x6c, 0x65, 0x6e)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.runlen)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "actuallyAdded"
|
|
err = en.Append(0xad, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x41, 0x64, 0x64, 0x65, 0x64)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.actuallyAdded)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "m"
|
|
err = en.Append(0xa1, 0x6d)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.m)))
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zxvk := range z.m {
|
|
// map header, size 2
|
|
// write "start"
|
|
err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.m[zxvk].start)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "last"
|
|
err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.m[zxvk].last)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
// write "rc"
|
|
err = en.Append(0xa2, 0x72, 0x63)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if z.rc == nil {
|
|
err = en.WriteNil()
|
|
if err != nil {
|
|
return
|
|
}
|
|
} else {
|
|
// map header, size 2
|
|
// write "iv"
|
|
err = en.Append(0x82, 0xa2, 0x69, 0x76)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.rc.iv)))
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zbzg := range z.rc.iv {
|
|
// map header, size 2
|
|
// write "start"
|
|
err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.rc.iv[zbzg].start)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "last"
|
|
err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.rc.iv[zbzg].last)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
// write "card"
|
|
err = en.Append(0xa4, 0x63, 0x61, 0x72, 0x64)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteInt64(z.rc.card)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *addHelper32) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 5
|
|
// string "runstart"
|
|
o = append(o, 0x85, 0xa8, 0x72, 0x75, 0x6e, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
o = msgp.AppendUint32(o, z.runstart)
|
|
// string "runlen"
|
|
o = append(o, 0xa6, 0x72, 0x75, 0x6e, 0x6c, 0x65, 0x6e)
|
|
o = msgp.AppendUint32(o, z.runlen)
|
|
// string "actuallyAdded"
|
|
o = append(o, 0xad, 0x61, 0x63, 0x74, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x41, 0x64, 0x64, 0x65, 0x64)
|
|
o = msgp.AppendUint32(o, z.actuallyAdded)
|
|
// string "m"
|
|
o = append(o, 0xa1, 0x6d)
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.m)))
|
|
for zxvk := range z.m {
|
|
// map header, size 2
|
|
// string "start"
|
|
o = append(o, 0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
o = msgp.AppendUint32(o, z.m[zxvk].start)
|
|
// string "last"
|
|
o = append(o, 0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
o = msgp.AppendUint32(o, z.m[zxvk].last)
|
|
}
|
|
// string "rc"
|
|
o = append(o, 0xa2, 0x72, 0x63)
|
|
if z.rc == nil {
|
|
o = msgp.AppendNil(o)
|
|
} else {
|
|
// map header, size 2
|
|
// string "iv"
|
|
o = append(o, 0x82, 0xa2, 0x69, 0x76)
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.rc.iv)))
|
|
for zbzg := range z.rc.iv {
|
|
// map header, size 2
|
|
// string "start"
|
|
o = append(o, 0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
o = msgp.AppendUint32(o, z.rc.iv[zbzg].start)
|
|
// string "last"
|
|
o = append(o, 0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
o = msgp.AppendUint32(o, z.rc.iv[zbzg].last)
|
|
}
|
|
// string "card"
|
|
o = append(o, 0xa4, 0x63, 0x61, 0x72, 0x64)
|
|
o = msgp.AppendInt64(o, z.rc.card)
|
|
}
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *addHelper32) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zxhx uint32
|
|
zxhx, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zxhx > 0 {
|
|
zxhx--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "runstart":
|
|
z.runstart, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "runlen":
|
|
z.runlen, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "actuallyAdded":
|
|
z.actuallyAdded, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "m":
|
|
var zlqf uint32
|
|
zlqf, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap(z.m) >= int(zlqf) {
|
|
z.m = (z.m)[:zlqf]
|
|
} else {
|
|
z.m = make([]interval32, zlqf)
|
|
}
|
|
for zxvk := range z.m {
|
|
var zdaf uint32
|
|
zdaf, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zdaf > 0 {
|
|
zdaf--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.m[zxvk].start, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.m[zxvk].last, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case "rc":
|
|
if msgp.IsNil(bts) {
|
|
bts, err = msgp.ReadNilBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
z.rc = nil
|
|
} else {
|
|
if z.rc == nil {
|
|
z.rc = new(runContainer32)
|
|
}
|
|
var zpks uint32
|
|
zpks, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zpks > 0 {
|
|
zpks--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "iv":
|
|
var zjfb uint32
|
|
zjfb, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap(z.rc.iv) >= int(zjfb) {
|
|
z.rc.iv = (z.rc.iv)[:zjfb]
|
|
} else {
|
|
z.rc.iv = make([]interval32, zjfb)
|
|
}
|
|
for zbzg := range z.rc.iv {
|
|
var zcxo uint32
|
|
zcxo, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zcxo > 0 {
|
|
zcxo--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.rc.iv[zbzg].start, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.rc.iv[zbzg].last, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case "card":
|
|
z.rc.card, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *addHelper32) Msgsize() (s int) {
|
|
s = 1 + 9 + msgp.Uint32Size + 7 + msgp.Uint32Size + 14 + msgp.Uint32Size + 2 + msgp.ArrayHeaderSize + (len(z.m) * (12 + msgp.Uint32Size + msgp.Uint32Size)) + 3
|
|
if z.rc == nil {
|
|
s += msgp.NilSize
|
|
} else {
|
|
s += 1 + 3 + msgp.ArrayHeaderSize + (len(z.rc.iv) * (12 + msgp.Uint32Size + msgp.Uint32Size)) + 5 + msgp.Int64Size
|
|
}
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *interval32) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zeff uint32
|
|
zeff, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zeff > 0 {
|
|
zeff--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.start, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.last, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z interval32) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 2
|
|
// write "start"
|
|
err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.start)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "last"
|
|
err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.last)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z interval32) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 2
|
|
// string "start"
|
|
o = append(o, 0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
o = msgp.AppendUint32(o, z.start)
|
|
// string "last"
|
|
o = append(o, 0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
o = msgp.AppendUint32(o, z.last)
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *interval32) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zrsw uint32
|
|
zrsw, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zrsw > 0 {
|
|
zrsw--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.start, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.last, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z interval32) Msgsize() (s int) {
|
|
s = 1 + 6 + msgp.Uint32Size + 5 + msgp.Uint32Size
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *runContainer32) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zdnj uint32
|
|
zdnj, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zdnj > 0 {
|
|
zdnj--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "iv":
|
|
var zobc uint32
|
|
zobc, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap(z.iv) >= int(zobc) {
|
|
z.iv = (z.iv)[:zobc]
|
|
} else {
|
|
z.iv = make([]interval32, zobc)
|
|
}
|
|
for zxpk := range z.iv {
|
|
var zsnv uint32
|
|
zsnv, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zsnv > 0 {
|
|
zsnv--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.iv[zxpk].start, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.iv[zxpk].last, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case "card":
|
|
z.card, err = dc.ReadInt64()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *runContainer32) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 2
|
|
// write "iv"
|
|
err = en.Append(0x82, 0xa2, 0x69, 0x76)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteArrayHeader(uint32(len(z.iv)))
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zxpk := range z.iv {
|
|
// map header, size 2
|
|
// write "start"
|
|
err = en.Append(0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.iv[zxpk].start)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "last"
|
|
err = en.Append(0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.iv[zxpk].last)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
// write "card"
|
|
err = en.Append(0xa4, 0x63, 0x61, 0x72, 0x64)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteInt64(z.card)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *runContainer32) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 2
|
|
// string "iv"
|
|
o = append(o, 0x82, 0xa2, 0x69, 0x76)
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z.iv)))
|
|
for zxpk := range z.iv {
|
|
// map header, size 2
|
|
// string "start"
|
|
o = append(o, 0x82, 0xa5, 0x73, 0x74, 0x61, 0x72, 0x74)
|
|
o = msgp.AppendUint32(o, z.iv[zxpk].start)
|
|
// string "last"
|
|
o = append(o, 0xa4, 0x6c, 0x61, 0x73, 0x74)
|
|
o = msgp.AppendUint32(o, z.iv[zxpk].last)
|
|
}
|
|
// string "card"
|
|
o = append(o, 0xa4, 0x63, 0x61, 0x72, 0x64)
|
|
o = msgp.AppendInt64(o, z.card)
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *runContainer32) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zkgt uint32
|
|
zkgt, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zkgt > 0 {
|
|
zkgt--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "iv":
|
|
var zema uint32
|
|
zema, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap(z.iv) >= int(zema) {
|
|
z.iv = (z.iv)[:zema]
|
|
} else {
|
|
z.iv = make([]interval32, zema)
|
|
}
|
|
for zxpk := range z.iv {
|
|
var zpez uint32
|
|
zpez, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zpez > 0 {
|
|
zpez--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "start":
|
|
z.iv[zxpk].start, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "last":
|
|
z.iv[zxpk].last, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
case "card":
|
|
z.card, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *runContainer32) Msgsize() (s int) {
|
|
s = 1 + 3 + msgp.ArrayHeaderSize + (len(z.iv) * (12 + msgp.Uint32Size + msgp.Uint32Size)) + 5 + msgp.Int64Size
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *runIterator32) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zqke uint32
|
|
zqke, err = dc.ReadMapHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zqke > 0 {
|
|
zqke--
|
|
field, err = dc.ReadMapKeyPtr()
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "rc":
|
|
if dc.IsNil() {
|
|
err = dc.ReadNil()
|
|
if err != nil {
|
|
return
|
|
}
|
|
z.rc = nil
|
|
} else {
|
|
if z.rc == nil {
|
|
z.rc = new(runContainer32)
|
|
}
|
|
err = z.rc.DecodeMsg(dc)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
case "curIndex":
|
|
z.curIndex, err = dc.ReadInt64()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "curPosInIndex":
|
|
z.curPosInIndex, err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "curSeq":
|
|
z.curSeq, err = dc.ReadInt64()
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
err = dc.Skip()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z *runIterator32) EncodeMsg(en *msgp.Writer) (err error) {
|
|
// map header, size 4
|
|
// write "rc"
|
|
err = en.Append(0x84, 0xa2, 0x72, 0x63)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if z.rc == nil {
|
|
err = en.WriteNil()
|
|
if err != nil {
|
|
return
|
|
}
|
|
} else {
|
|
err = z.rc.EncodeMsg(en)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
// write "curIndex"
|
|
err = en.Append(0xa8, 0x63, 0x75, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteInt64(z.curIndex)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "curPosInIndex"
|
|
err = en.Append(0xad, 0x63, 0x75, 0x72, 0x50, 0x6f, 0x73, 0x49, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteUint32(z.curPosInIndex)
|
|
if err != nil {
|
|
return
|
|
}
|
|
// write "curSeq"
|
|
err = en.Append(0xa6, 0x63, 0x75, 0x72, 0x53, 0x65, 0x71)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = en.WriteInt64(z.curSeq)
|
|
if err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z *runIterator32) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
// map header, size 4
|
|
// string "rc"
|
|
o = append(o, 0x84, 0xa2, 0x72, 0x63)
|
|
if z.rc == nil {
|
|
o = msgp.AppendNil(o)
|
|
} else {
|
|
o, err = z.rc.MarshalMsg(o)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
// string "curIndex"
|
|
o = append(o, 0xa8, 0x63, 0x75, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78)
|
|
o = msgp.AppendInt64(o, z.curIndex)
|
|
// string "curPosInIndex"
|
|
o = append(o, 0xad, 0x63, 0x75, 0x72, 0x50, 0x6f, 0x73, 0x49, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78)
|
|
o = msgp.AppendUint32(o, z.curPosInIndex)
|
|
// string "curSeq"
|
|
o = append(o, 0xa6, 0x63, 0x75, 0x72, 0x53, 0x65, 0x71)
|
|
o = msgp.AppendInt64(o, z.curSeq)
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *runIterator32) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var field []byte
|
|
_ = field
|
|
var zqyh uint32
|
|
zqyh, bts, err = msgp.ReadMapHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zqyh > 0 {
|
|
zqyh--
|
|
field, bts, err = msgp.ReadMapKeyZC(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
switch msgp.UnsafeString(field) {
|
|
case "rc":
|
|
if msgp.IsNil(bts) {
|
|
bts, err = msgp.ReadNilBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
z.rc = nil
|
|
} else {
|
|
if z.rc == nil {
|
|
z.rc = new(runContainer32)
|
|
}
|
|
bts, err = z.rc.UnmarshalMsg(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
case "curIndex":
|
|
z.curIndex, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "curPosInIndex":
|
|
z.curPosInIndex, bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
case "curSeq":
|
|
z.curSeq, bts, err = msgp.ReadInt64Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
default:
|
|
bts, err = msgp.Skip(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z *runIterator32) Msgsize() (s int) {
|
|
s = 1 + 3
|
|
if z.rc == nil {
|
|
s += msgp.NilSize
|
|
} else {
|
|
s += z.rc.Msgsize()
|
|
}
|
|
s += 9 + msgp.Int64Size + 14 + msgp.Uint32Size + 7 + msgp.Int64Size
|
|
return
|
|
}
|
|
|
|
// DecodeMsg implements msgp.Decodable
|
|
func (z *uint32Slice) DecodeMsg(dc *msgp.Reader) (err error) {
|
|
var zjpj uint32
|
|
zjpj, err = dc.ReadArrayHeader()
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap((*z)) >= int(zjpj) {
|
|
(*z) = (*z)[:zjpj]
|
|
} else {
|
|
(*z) = make(uint32Slice, zjpj)
|
|
}
|
|
for zywj := range *z {
|
|
(*z)[zywj], err = dc.ReadUint32()
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// EncodeMsg implements msgp.Encodable
|
|
func (z uint32Slice) EncodeMsg(en *msgp.Writer) (err error) {
|
|
err = en.WriteArrayHeader(uint32(len(z)))
|
|
if err != nil {
|
|
return
|
|
}
|
|
for zzpf := range z {
|
|
err = en.WriteUint32(z[zzpf])
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|
|
// MarshalMsg implements msgp.Marshaler
|
|
func (z uint32Slice) MarshalMsg(b []byte) (o []byte, err error) {
|
|
o = msgp.Require(b, z.Msgsize())
|
|
o = msgp.AppendArrayHeader(o, uint32(len(z)))
|
|
for zzpf := range z {
|
|
o = msgp.AppendUint32(o, z[zzpf])
|
|
}
|
|
return
|
|
}
|
|
|
|
// UnmarshalMsg implements msgp.Unmarshaler
|
|
func (z *uint32Slice) UnmarshalMsg(bts []byte) (o []byte, err error) {
|
|
var zgmo uint32
|
|
zgmo, bts, err = msgp.ReadArrayHeaderBytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if cap((*z)) >= int(zgmo) {
|
|
(*z) = (*z)[:zgmo]
|
|
} else {
|
|
(*z) = make(uint32Slice, zgmo)
|
|
}
|
|
for zrfe := range *z {
|
|
(*z)[zrfe], bts, err = msgp.ReadUint32Bytes(bts)
|
|
if err != nil {
|
|
return
|
|
}
|
|
}
|
|
o = bts
|
|
return
|
|
}
|
|
|
|
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
|
|
func (z uint32Slice) Msgsize() (s int) {
|
|
s = msgp.ArrayHeaderSize + (len(z) * (msgp.Uint32Size))
|
|
return
|
|
}
|