1
0
mirror of https://github.com/fumiama/orbyte.git synced 2026-06-06 02:30:30 +08:00

feat: add async conflict detection

This commit is contained in:
源文雨
2025-04-14 22:41:19 +09:00
parent ac9d26dfb9
commit 162407d64e
8 changed files with 86 additions and 17 deletions

View File

@@ -10,23 +10,19 @@ import (
func (bufferPool BufferPool[USRDAT]) NewBuffer(
buf []byte,
) *orbyte.Item[UserBuffer[USRDAT]] {
return bufferPool.p.New(buf)
return bufferPool.New(buf)
}
// InvolveBuffer involve external *bytes.Buffer into Item.
func (bufferPool BufferPool[USRDAT]) InvolveBuffer(
buf *bytes.Buffer,
) *orbyte.Item[UserBuffer[USRDAT]] {
return bufferPool.p.Involve(buf.Len(), buf)
return bufferPool.Involve(buf.Len(), buf)
}
// ParseBuffer convert external *bytes.Buffer into Item.
func (bufferPool BufferPool[USRDAT]) ParseBuffer(
buf *bytes.Buffer,
) *orbyte.Item[UserBuffer[USRDAT]] {
return bufferPool.p.Parse(buf.Len(), buf)
}
func (bufferPool BufferPool[USRDAT]) CountItems() (outside int32, inside int32) {
return bufferPool.p.CountItems()
return bufferPool.Parse(buf.Len(), buf)
}