William Petit
8e574c299b
All checks were successful
arcad/edge/pipeline/pr-master This commit looks good
32 lines
510 B
Go
32 lines
510 B
Go
package blob
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type CloseReaderArgs struct {
|
|
ReaderID ReaderID
|
|
}
|
|
|
|
type CloseReaderReply struct {
|
|
}
|
|
|
|
func (s *Service) CloseReader(ctx context.Context, args *CloseReaderArgs, reply *CloseReaderReply) error {
|
|
reader, err := s.getOpenedReader(args.ReaderID)
|
|
if err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
if err := reader.Close(); err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
s.readers.Delete(args.ReaderID)
|
|
|
|
*reply = CloseReaderReply{}
|
|
|
|
return nil
|
|
}
|