Documentation
¶
Index ¶
- Variables
- type CreateCall
- type FileIndex
- type GetCall
- type IndexManager
- type LogRepairer
- type LogWriter
- type MockPartition
- func (p *MockPartition) Close() error
- func (p *MockPartition) Offset() uint64
- func (p *MockPartition) Read(b []byte) (int, error)
- func (p *MockPartition) Reader() io.Reader
- func (p *MockPartition) SetData(b []byte) *MockPartition
- func (p *MockPartition) SetOffset(off uint64) *MockPartition
- func (p *MockPartition) SetReader(r io.ReadCloser) *MockPartition
- func (p *MockPartition) Size() int
- type MockPartitions
- func (m *MockPartitions) Create(offset uint64) (Partitioner, error)
- func (m *MockPartitions) CreateCalls() []CreateCall
- func (m *MockPartitions) FailCreateAfter(n int) *MockPartitions
- func (m *MockPartitions) FailGetAfter(n int) *MockPartitions
- func (m *MockPartitions) FailListAfter(n int) *MockPartitions
- func (m *MockPartitions) FailRemoveAfter(n int) *MockPartitions
- func (m *MockPartitions) Get(offset uint64, delta int, limit int) (Partitioner, error)
- func (m *MockPartitions) GetCalls() []GetCall
- func (m *MockPartitions) List() ([]uint64, error)
- func (m *MockPartitions) ListCalls() int
- func (m *MockPartitions) Remove(offset uint64) error
- func (m *MockPartitions) RemoveCalls() []RemoveCall
- func (m *MockPartitions) SetNextError(err error) *MockPartitions
- func (m *MockPartitions) Shutdown() error
- func (m *MockPartitions) Uncirculate(offset uint64) error
- type MockWriter
- type Partition
- type PartitionFile
- type PartitionManager
- type Partitioner
- type Partitions
- func (p *Partitions) Get(off uint64, delta, limit int) (Partitioner, error)
- func (p *Partitions) Len() int
- func (p *Partitions) Less(i, j int) bool
- func (p *Partitions) List() ([]Partitioner, error)
- func (p *Partitions) Remove(off uint64) error
- func (p *Partitions) Setup() error
- func (p *Partitions) Shutdown() error
- func (p *Partitions) Swap(i, j int)
- type RemoveCall
- type Repairer
- type TopicManager
- type Topics
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("partition not found")
ErrNotFound is returned when a partition could not be found
Functions ¶
This section is empty.
Types ¶
type CreateCall ¶
type CreateCall struct {
// contains filtered or unexported fields
}
CreateCall contains the arguments passed to a call to Create
type FileIndex ¶ added in v0.1.1
type FileIndex struct {
// contains filtered or unexported fields
}
func NewFileIndex ¶ added in v0.1.1
type GetCall ¶
type GetCall struct {
// contains filtered or unexported fields
}
GetCall contains the arguments passed to a call to Get
type IndexManager ¶ added in v0.1.1
type LogRepairer ¶
type LogRepairer interface { Truncate(part uint64, size int64) error Data(part uint64) (io.ReadCloser, error) }
LogRepairer truncates corrupted data
type LogWriter ¶
type LogWriter interface { io.WriteCloser Flush() error SetPartition(off uint64) error }
LogWriter is the new log writer interface
type MockPartition ¶
type MockPartition struct {
// contains filtered or unexported fields
}
MockPartition can be used for testing purposes
func NewMockPartition ¶
func NewMockPartition(conf *config.Config) *MockPartition
NewMockPartition returns a new instance of MockPartition
func (*MockPartition) Offset ¶
func (p *MockPartition) Offset() uint64
Offset implements Partitioner
func (*MockPartition) Reader ¶
func (p *MockPartition) Reader() io.Reader
Reader implements Partitioner
func (*MockPartition) SetData ¶
func (p *MockPartition) SetData(b []byte) *MockPartition
SetData sets the data on the partition
func (*MockPartition) SetOffset ¶
func (p *MockPartition) SetOffset(off uint64) *MockPartition
SetOffset sets the offset on the partition
func (*MockPartition) SetReader ¶
func (p *MockPartition) SetReader(r io.ReadCloser) *MockPartition
SetReader sets the reader the partition will return from Get
type MockPartitions ¶
type MockPartitions struct {
// contains filtered or unexported fields
}
MockPartitions can be used for testing purposes
func NewMockPartitions ¶
func NewMockPartitions(conf *config.Config) *MockPartitions
NewMockPartitions returns an instance of MockPartitions
func (*MockPartitions) Create ¶
func (m *MockPartitions) Create(offset uint64) (Partitioner, error)
Create implements PartitionManager
func (*MockPartitions) CreateCalls ¶
func (m *MockPartitions) CreateCalls() []CreateCall
CreateCalls returns a list containing the arguments supplied to each previous Create call
func (*MockPartitions) FailCreateAfter ¶
func (m *MockPartitions) FailCreateAfter(n int) *MockPartitions
FailCreateAfter returns an error after Create is called n times
func (*MockPartitions) FailGetAfter ¶
func (m *MockPartitions) FailGetAfter(n int) *MockPartitions
FailGetAfter returns an error after Get is called n times
func (*MockPartitions) FailListAfter ¶
func (m *MockPartitions) FailListAfter(n int) *MockPartitions
FailListAfter returns an error after List is called n times
func (*MockPartitions) FailRemoveAfter ¶
func (m *MockPartitions) FailRemoveAfter(n int) *MockPartitions
FailRemoveAfter returns an error after Remove is called n times
func (*MockPartitions) Get ¶
func (m *MockPartitions) Get(offset uint64, delta int, limit int) (Partitioner, error)
Get implements PartitionManager
func (*MockPartitions) GetCalls ¶
func (m *MockPartitions) GetCalls() []GetCall
GetCalls returns a list containing the arguments supplied to each previous Get call
func (*MockPartitions) List ¶
func (m *MockPartitions) List() ([]uint64, error)
List implements PartitionManager
func (*MockPartitions) ListCalls ¶
func (m *MockPartitions) ListCalls() int
ListCalls returns the number of times List was called
func (*MockPartitions) Remove ¶
func (m *MockPartitions) Remove(offset uint64) error
Remove implements PartitionManager
func (*MockPartitions) RemoveCalls ¶
func (m *MockPartitions) RemoveCalls() []RemoveCall
RemoveCalls returns a list containing the arguments supplied to each previous Remove call
func (*MockPartitions) SetNextError ¶
func (m *MockPartitions) SetNextError(err error) *MockPartitions
SetNextError sets an error to be returned from the next call
func (*MockPartitions) Shutdown ¶
func (m *MockPartitions) Shutdown() error
Shutdown implements PartitionManager
func (*MockPartitions) Uncirculate ¶
func (m *MockPartitions) Uncirculate(offset uint64) error
Uncirculate implements PartitionManager
type MockWriter ¶
type MockWriter struct {
// contains filtered or unexported fields
}
MockWriter can be used for testing purposes
func NewDiscardWriter ¶
func NewDiscardWriter(conf *config.Config) *MockWriter
NewDiscardWriter returns a logger that discards all input
func NewMockWriter ¶
func NewMockWriter(conf *config.Config) *MockWriter
NewMockWriter returns an instance of MockWriter
func (*MockWriter) Partitions ¶
func (w *MockWriter) Partitions() []*bytes.Buffer
Partitions returns a list of *bytes.Buffer-s containing the state of the log
func (*MockWriter) SetPartition ¶
func (w *MockWriter) SetPartition(off uint64) error
SetPartition implements LogWriter
func (*MockWriter) SetWriter ¶
func (w *MockWriter) SetWriter(wr io.Writer) *MockWriter
SetWriter sets the io.Writer on the MockWriter. The writer can also implement Flush.
type Partition ¶
type Partition struct {
// contains filtered or unexported fields
}
Partition implements Partitioner
func NewPartition ¶
NewPartition returns a new instance of Partition
type PartitionFile ¶
type PartitionFile struct {
// contains filtered or unexported fields
}
PartitionFile wraps a LimitReader(*os.File) so it can be unwrapped by the socket and sendfile can be leveraged. PartitionFile is also involved in deletions. each partition on disk should have an associated reference count, and when it's slated for deletion, it should wait until all references have been closed before deleting the file from disk. It should move the file into a temp directory so subsequent requests for deleted offsets return not found errors.
type PartitionManager ¶
type PartitionManager interface { // Remove deletes a partition. If the partition doesn't exist, return an // error. Remove(off uint64) error // Get returns an io.Reader representing the partition located at offset, // its start position seeked to delta, and limited to limit bytes. Get(offset uint64, delta, limit int) (Partitioner, error) // List returns a list of the currently available partition offsets List() ([]Partitioner, error) }
PartitionManager gets, create, and otherwise manages partitions
type Partitioner ¶
Partitioner wraps the log partition. in most usage, an *os.File
type Partitions ¶
type Partitions struct {
// contains filtered or unexported fields
}
Partitions implements PartitionManager. It creates, removes, lists, and gets Partitions to be read from by server connections.
func NewPartitions ¶
func NewPartitions(conf *config.Config, topic string) *Partitions
NewPartitions returns an instance of Partitions, which implements PartitionManager
func (*Partitions) Get ¶
func (p *Partitions) Get(off uint64, delta, limit int) (Partitioner, error)
Get implements PartitionManager
func (*Partitions) List ¶
func (p *Partitions) List() ([]Partitioner, error)
List implements PartitionManager
func (*Partitions) Remove ¶
func (p *Partitions) Remove(off uint64) error
Remove implements PartitionManager
func (*Partitions) Setup ¶
func (p *Partitions) Setup() error
Setup implements internal.LifecycleManager
func (*Partitions) Shutdown ¶
func (p *Partitions) Shutdown() error
Shutdown implements internal.LifecycleManager
type RemoveCall ¶
type RemoveCall struct {
// contains filtered or unexported fields
}
RemoveCall contains the arguments passed to a call to Remove
type Repairer ¶
type Repairer struct {
// contains filtered or unexported fields
}
Repairer implements LogRepairer using the filesystem
func NewRepairer ¶
NewRepairer returns a new instance of *Repairer
type TopicManager ¶
type TopicManager interface { List() ([]string, error) Create(topic string) error Remove(topic string) error }
TopicManager deals with the listing of topics, which typically will exist as directories in the filesystem. TODO it should probably create/remove them as well
type Topics ¶
type Topics struct {
// contains filtered or unexported fields
}
Topics implements TopicManager
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer writes to the log
func (*Writer) SetPartition ¶
SetPartition implements LogWriter interface