forked from forgejo/forgejo
Integrate public as bindata optionally (#293)
* Dropped unused codekit config * Integrated dynamic and static bindata for public * Ignore public bindata * Add a general generate make task * Integrated flexible public assets into web command * Updated vendoring, added all missiong govendor deps * Made the linter happy with the bindata and dynamic code * Moved public bindata definition to modules directory * Ignoring the new bindata path now * Updated to the new public modules import path * Updated public bindata command and drop the new prefix
This commit is contained in:
parent
4680c349dd
commit
b6a95a8cb3
691 changed files with 305318 additions and 1272 deletions
45
vendor/github.com/ngaut/tso/proto/proto.go
generated
vendored
Normal file
45
vendor/github.com/ngaut/tso/proto/proto.go
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
package proto
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
|
||||
"github.com/juju/errors"
|
||||
)
|
||||
|
||||
// RequestHeader is for tso request proto.
|
||||
type RequestHeader struct {
|
||||
}
|
||||
|
||||
// Timestamp is for tso timestamp.
|
||||
type Timestamp struct {
|
||||
Physical int64
|
||||
Logical int64
|
||||
}
|
||||
|
||||
// Response is for tso reponse proto.
|
||||
type Response struct {
|
||||
Timestamp
|
||||
}
|
||||
|
||||
// Encode encodes repsonse proto into w.
|
||||
func (res *Response) Encode(w io.Writer) error {
|
||||
var buf [16]byte
|
||||
binary.BigEndian.PutUint64(buf[0:8], uint64(res.Physical))
|
||||
binary.BigEndian.PutUint64(buf[8:16], uint64(res.Logical))
|
||||
_, err := w.Write(buf[0:16])
|
||||
return errors.Trace(err)
|
||||
}
|
||||
|
||||
// Decode decodes reponse proto from r.
|
||||
func (res *Response) Decode(r io.Reader) error {
|
||||
var buf [16]byte
|
||||
_, err := io.ReadFull(r, buf[0:16])
|
||||
if err != nil {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
|
||||
res.Physical = int64(binary.BigEndian.Uint64(buf[0:8]))
|
||||
res.Logical = int64(binary.BigEndian.Uint64(buf[8:16]))
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue