Documentation ¶
Overview ¶
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- type AutumnEntryIter
- type AutumnStreamClient
- func (sc *AutumnStreamClient) Append(ctx context.Context, blocks []block, mustSync bool) (uint64, []uint32, uint32, error)
- func (sc *AutumnStreamClient) Close()
- func (sc *AutumnStreamClient) CommitEnd() uint32
- func (sc *AutumnStreamClient) Connect() error
- func (sc *AutumnStreamClient) MustAllocNewExtent() error
- func (sc *AutumnStreamClient) NewLogEntryIter(opts ...ReadOption) LogEntryIter
- func (sc *AutumnStreamClient) PunchHoles(ctx context.Context, extentIDs []uint64) error
- func (sc *AutumnStreamClient) Read(ctx context.Context, extentID uint64, offset uint32, numOfBlocks uint32) ([]block, uint32, error)
- func (sc *AutumnStreamClient) ReadLastBlock(ctx context.Context) (block, error)
- func (sc *AutumnStreamClient) SealedLength(extentID uint64) (uint64, error)
- func (sc *AutumnStreamClient) StreamInfo() *pb.StreamInfo
- func (sc *AutumnStreamClient) Truncate(ctx context.Context, extentID uint64) error
- type LogEntryIter
- type MockBlockReader
- type MockLockEntryIter
- type MockStreamClient
- func (client *MockStreamClient) Append(ctx context.Context, blocks []block, mustSync bool) (uint64, []uint32, uint32, error)
- func (client *MockStreamClient) CheckCommitLength() error
- func (client *MockStreamClient) Close()
- func (client *MockStreamClient) CommitEnd() uint32
- func (client *MockStreamClient) Connect() error
- func (client *MockStreamClient) NewLogEntryIter(opts ...ReadOption) LogEntryIter
- func (client *MockStreamClient) PunchHoles(ctx context.Context, extentIDs []uint64) error
- func (client *MockStreamClient) Read(ctx context.Context, extentID uint64, offset uint32, numOfBlocks uint32) ([]block, uint32, error)
- func (client *MockStreamClient) ReadLastBlock(ctx context.Context) (block, error)
- func (client *MockStreamClient) SealedLength(extentID uint64) (uint64, error)
- func (client *MockStreamClient) StreamInfo() *pb.StreamInfo
- func (client *MockStreamClient) Truncate(ctx context.Context, extentID uint64) error
- type ReadOption
- type StreamClient
- type StreamLock
Constants ¶
View Source
const ( KB = 1024 MB = 1024 * KB GB = 1024 * MB HardMaxExtentSize = 3 * GB //Hard limit of extent size )
View Source
const ( HintReadThrough = 1 << 0 HintReadFromCache byte = 1 << 1 )
hint
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutumnEntryIter ¶
type AutumnEntryIter struct {
// contains filtered or unexported fields
}
func (*AutumnEntryIter) HasNext ¶
func (iter *AutumnEntryIter) HasNext() (bool, error)
type AutumnStreamClient ¶
type AutumnStreamClient struct { utils.SafeMutex //protect streamInfo from allocStream, Truncate, PunchHole // contains filtered or unexported fields }
for single stream
func NewStreamClient ¶
func NewStreamClient(sm *smclient.SMClient, em *smclient.ExtentManager, maxExtentSize uint32, streamID uint64, streamLock StreamLock) *AutumnStreamClient
func (*AutumnStreamClient) Close ¶
func (sc *AutumnStreamClient) Close()
func (*AutumnStreamClient) CommitEnd ¶
func (sc *AutumnStreamClient) CommitEnd() uint32
func (*AutumnStreamClient) Connect ¶
func (sc *AutumnStreamClient) Connect() error
func (*AutumnStreamClient) MustAllocNewExtent ¶
func (sc *AutumnStreamClient) MustAllocNewExtent() error
alloc new extent, and reset sc.end = 0
func (*AutumnStreamClient) NewLogEntryIter ¶
func (sc *AutumnStreamClient) NewLogEntryIter(opts ...ReadOption) LogEntryIter
func (*AutumnStreamClient) PunchHoles ¶
func (sc *AutumnStreamClient) PunchHoles(ctx context.Context, extentIDs []uint64) error
func (*AutumnStreamClient) ReadLastBlock ¶
func (sc *AutumnStreamClient) ReadLastBlock(ctx context.Context) (block, error)
func (*AutumnStreamClient) SealedLength ¶
func (sc *AutumnStreamClient) SealedLength(extentID uint64) (uint64, error)
func (*AutumnStreamClient) StreamInfo ¶
func (sc *AutumnStreamClient) StreamInfo() *pb.StreamInfo
type LogEntryIter ¶
type MockBlockReader ¶
type MockLockEntryIter ¶
type MockLockEntryIter struct {
// contains filtered or unexported fields
}
func (*MockLockEntryIter) HasNext ¶
func (iter *MockLockEntryIter) HasNext() (bool, error)
type MockStreamClient ¶
type MockStreamClient struct { StreamClient ID uint64 utils.SafeMutex // contains filtered or unexported fields }
func (*MockStreamClient) Append ¶
func (client *MockStreamClient) Append(ctx context.Context, blocks []block, mustSync bool) (uint64, []uint32, uint32, error)
block API
func (*MockStreamClient) CheckCommitLength ¶
func (client *MockStreamClient) CheckCommitLength() error
func (*MockStreamClient) Close ¶
func (client *MockStreamClient) Close()
func (*MockStreamClient) CommitEnd ¶
func (client *MockStreamClient) CommitEnd() uint32
func (*MockStreamClient) Connect ¶
func (client *MockStreamClient) Connect() error
func (*MockStreamClient) NewLogEntryIter ¶
func (client *MockStreamClient) NewLogEntryIter(opts ...ReadOption) LogEntryIter
func (*MockStreamClient) PunchHoles ¶
func (client *MockStreamClient) PunchHoles(ctx context.Context, extentIDs []uint64) error
func (*MockStreamClient) ReadLastBlock ¶
func (client *MockStreamClient) ReadLastBlock(ctx context.Context) (block, error)
func (*MockStreamClient) SealedLength ¶
func (client *MockStreamClient) SealedLength(extentID uint64) (uint64, error)
func (*MockStreamClient) StreamInfo ¶
func (client *MockStreamClient) StreamInfo() *pb.StreamInfo
type ReadOption ¶
type ReadOption func(*readOption)
func WithReadFrom ¶
func WithReadFrom(extentID uint64, offset uint32, maxExtents int) ReadOption
func WithReadFromStart ¶
func WithReadFromStart(MaxExtentRead int) ReadOption
type StreamClient ¶
type StreamClient interface { Connect() error Close() //AppendEntries(ctx context.Context, entries []block, mustSync bool) (uint64, uint32, error) ReadLastBlock(ctx context.Context) (block, error) Append(ctx context.Context, blocks []block, mustSync bool) (extentID uint64, offsets []uint32, end uint32, err error) PunchHoles(ctx context.Context, extentIDs []uint64) error NewLogEntryIter(opt ...ReadOption) LogEntryIter //truncate extent BEFORE extentID Truncate(ctx context.Context, extentID uint64) error //CommitEnd() is offset of current extent CommitEnd() uint32 //FIMME:remove this //total number of extents StreamInfo() *pb.StreamInfo Read(ctx context.Context, extentID uint64, offset uint32, numOfBlocks uint32) ([]block, uint32, error) SealedLength(extentID uint64) (uint64, error) }
func NewMockStreamClient ¶
func NewMockStreamClient(suffix string) StreamClient
func OpenMockStreamClient ¶
func OpenMockStreamClient(si pb.StreamInfo, br *MockBlockReader) StreamClient
only open log file
type StreamLock ¶
type StreamLock struct {
// contains filtered or unexported fields
}
func MutexToLock ¶
func MutexToLock(mutex *concurrency.Mutex) StreamLock
Click to show internal directories.
Click to hide internal directories.