Documentation ¶
Index ¶
- Constants
- type OnDisk
- func (s *OnDisk) Ack(ctx context.Context, chunk string, size uint64) error
- func (s *OnDisk) AckDirect(chunk string) error
- func (s *OnDisk) ListChunks() ([]protocol.Chunk, error)
- func (s *OnDisk) Read(chunk string, off uint64, maxSize uint64, w io.Writer) error
- func (s *OnDisk) ReplicationAck(ctx context.Context, chunk, instance string, size uint64) error
- func (s *OnDisk) SetReplicationDisabled(v bool)
- func (s *OnDisk) Wait(ctx context.Context, chunkName string, off uint64, minSyncReplicas uint) error
- func (s *OnDisk) Write(ctx context.Context, msgs []byte) (chunkName string, off int64, err error)
- func (s *OnDisk) WriteDirect(chunk string, contents []byte) error
- type OnDiskCreator
- func (c *OnDiskCreator) AckDirect(ctx context.Context, category string, chunk string) error
- func (c *OnDiskCreator) Get(category string) (*OnDisk, error)
- func (c *OnDiskCreator) SetReplicationDisabled(category string, v bool) error
- func (c *OnDiskCreator) Stat(category string, fileName string) (size int64, exists bool, deleted bool, err error)
- func (c *OnDiskCreator) Write(ctx context.Context, category string, msgs []byte) (chunkName string, off int64, err error)
- func (c *OnDiskCreator) WriteDirect(category string, fileName string, contents []byte) error
- type StorageHooks
Constants ¶
const AcknowledgedSuffix = ".acknowledged"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OnDisk ¶
type OnDisk struct {
// contains filtered or unexported fields
}
OnDisk stores all the data on disk.
func NewOnDisk ¶
func NewOnDisk(logger *log.Logger, dirname, category, instanceName string, maxChunkSize uint64, maxLineSize uint64, rotateChunkInterval time.Duration, repl StorageHooks) (*OnDisk, error)
NewOnDisk creates a server that stores all it's data on disk.
func (*OnDisk) AckDirect ¶
AckDirect is a method that is called from replication to replay acknowledge requests on the replica side.
func (*OnDisk) ListChunks ¶
ListChunks returns the list of current chunks.
func (*OnDisk) Read ¶
Read copies the data from the in-memory store and writes the data read to the provided Writer, starting with the offset provided.
func (*OnDisk) ReplicationAck ¶
ReplicationAck lets writers that are waiting for min_sync_replicas to know that their writes were successful.
func (*OnDisk) SetReplicationDisabled ¶
func (*OnDisk) Wait ¶
func (s *OnDisk) Wait(ctx context.Context, chunkName string, off uint64, minSyncReplicas uint) error
Wait waits until the minSyncReplicas report back that they successfully downloaded the respective chunk from us.
type OnDiskCreator ¶
type OnDiskCreator struct {
// contains filtered or unexported fields
}
func NewOnDiskCreator ¶
func NewOnDiskCreator(logger *log.Logger, dirName string, instanceName string, replStorage *replication.Storage, maxChunkSize uint64, rotateChunkInterval time.Duration) *OnDiskCreator
func (*OnDiskCreator) SetReplicationDisabled ¶
func (c *OnDiskCreator) SetReplicationDisabled(category string, v bool) error
func (*OnDiskCreator) Stat ¶
func (c *OnDiskCreator) Stat(category string, fileName string) (size int64, exists bool, deleted bool, err error)
Stat returns information about the chunk: whether or not it exists and it's size. If file does not exist no error is returned.
func (*OnDiskCreator) WriteDirect ¶
func (c *OnDiskCreator) WriteDirect(category string, fileName string, contents []byte) error