forked from NYANDEV/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
64
vendor/github.com/pingcap/go-themis/themis_secondary_lock.go
generated
vendored
Normal file
64
vendor/github.com/pingcap/go-themis/themis_secondary_lock.go
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
package themis
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/juju/errors"
|
||||
"github.com/ngaut/log"
|
||||
"github.com/pingcap/go-hbase"
|
||||
"github.com/pingcap/go-hbase/iohelper"
|
||||
)
|
||||
|
||||
type themisSecondaryLock struct {
|
||||
*themisLock
|
||||
primaryCoordinate *hbase.ColumnCoordinate
|
||||
}
|
||||
|
||||
func newThemisSecondaryLock() *themisSecondaryLock {
|
||||
return &themisSecondaryLock{
|
||||
themisLock: &themisLock{
|
||||
clientAddr: "null",
|
||||
},
|
||||
primaryCoordinate: &hbase.ColumnCoordinate{},
|
||||
}
|
||||
}
|
||||
|
||||
func (l *themisSecondaryLock) Primary() Lock {
|
||||
pl := newThemisPrimaryLock()
|
||||
pl.coordinate = l.primaryCoordinate
|
||||
pl.ts = l.ts
|
||||
pl.clientAddr = l.clientAddr
|
||||
pl.addSecondary(l.coordinate, l.typ)
|
||||
return pl
|
||||
}
|
||||
|
||||
func (l *themisSecondaryLock) Secondaries() []Lock {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *themisSecondaryLock) Role() LockRole {
|
||||
return RoleSecondary
|
||||
}
|
||||
|
||||
func (l *themisSecondaryLock) Encode() []byte {
|
||||
buf := bytes.NewBuffer(nil)
|
||||
binary.Write(buf, binary.BigEndian, uint8(0))
|
||||
l.themisLock.write(buf)
|
||||
// TODO: handle error, now just log
|
||||
if err := l.primaryCoordinate.Write(buf); err != nil {
|
||||
log.Warnf("write error, primary coordinate: %s, buf: %s, err: %v", l, buf, err)
|
||||
}
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
func (l *themisSecondaryLock) parse(r iohelper.ByteMultiReader) error {
|
||||
l.themisLock.parse(r)
|
||||
primary := &hbase.ColumnCoordinate{}
|
||||
err := primary.ParseField(r)
|
||||
if err != nil {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
l.primaryCoordinate = primary
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue