Browse Source

add Write method to autofile/Group

pull/1842/head
Anton Kaliaev 7 years ago
parent
commit
45095e83e7
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 11 additions and 0 deletions
  1. +11
    -0
      autofile/group.go

+ 11
- 0
autofile/group.go View File

@ -146,6 +146,17 @@ func (g *Group) MaxIndex() int {
return g.maxIndex
}
// Write writes the contents of p into the current head of the group. It
// returns the number of bytes written. If nn < len(p), it also returns an
// error explaining why the write is short.
// NOTE: Writes are buffered so they don't write synchronously
// TODO: Make it halt if space is unavailable
func (g *Group) Write(p []byte) (nn int, err error) {
g.mtx.Lock()
defer g.mtx.Unlock()
return g.headBuf.Write(p)
}
// WriteLine writes line into the current head of the group. It also appends "\n".
// NOTE: Writes are buffered so they don't write synchronously
// TODO: Make it halt if space is unavailable


Loading…
Cancel
Save