Documentation
¶
Index ¶
- Constants
- Variables
- func AWSSession() *awsSession.Session
- type CalibratePriority
- type Chunk
- func (c *Chunk) Access() []byte
- func (c *Chunk) AddRecovered(bytes uint64) bool
- func (c *Chunk) Delete(reason string)
- func (c *Chunk) EndRecover(status uint32)
- func (c *Chunk) IsAvailable() bool
- func (c *Chunk) IsBuffered(includeTBD bool) bool
- func (c *Chunk) IsDeleted() bool
- func (c *Chunk) IsIncomplete() bool
- func (c *Chunk) IsRecovering() bool
- func (c *Chunk) NotifyRecovered()
- func (c *Chunk) Op() uint32
- func (c *Chunk) PrepareRecover() bool
- func (c *Chunk) StartRecover()
- func (c *Chunk) WaitRecovered()
- type CommitOption
- type Lineage
- type LineageMeta
- type LineageMetaType
- type LineageOp
- type LineageStatus
- type LineageTerm
- type LineageValidationResult
- type Loggable
- type OpRet
- type OpWrapper
- type PersistentStorage
- type ServerStats
- type Storage
- type StorageMeta
Constants ¶
View Source
const ( OP_SET = 0 OP_GET = 1 OP_DEL = 2 OP_RECOVER = 3 OP_WARMUP = 90 OP_MIGRATION = 91 OP_RECOVERY = 92 // Recover repository OP_COMMIT = 93 // Commit lineage CHUNK_AVAILABLE = 0 CHUNK_DELETED = 1 CHUNK_RECOVERING = 2 CHUNK_INCOMPLETE = 3 CHUNK_TOBEBUFFERED = -1 )
Variables ¶
View Source
var ( // Provided by amazon. AWSRegion = os.Getenv("AWS_REGION") UploadConcurrency = 5 DownloadConcurrency = 10 // AWSDummyTimeout = 10 * time.Millisecond AWSServiceTimeout = 10000 * time.Millisecond )
Functions ¶
func AWSSession ¶
func AWSSession() *awsSession.Session
Types ¶
type CalibratePriority ¶
type CalibratePriority int
type Chunk ¶
type Chunk struct {
Key string
Id string // Obsoleted, chunk id of the object
Body []byte
Size uint64
Term uint64 // Lineage term of last write operation.
// Status of the chunk, can be one of CHUNK_AVAILABLE, CHUNK_DELETED, or CHUNK_RECOVERING
// CHUNK_RECOVERING is only used for ensure atomicity, check Available to ensure recovery status.
Status uint32
Available uint64 // Bytes available now. Used for recovering
Notifier sync.WaitGroup // See benchmarks in github.com/ds2-lab/infinistore/common/sync
Accessed time.Time
Bucket string
Backup bool
BuffIdx int // Index in buffer queue
Note string // Reason for the status.
}
For storage
func (*Chunk) AddRecovered ¶
AddRecovered tracks recovery progress.
func (*Chunk) EndRecover ¶
NotifyRecovered notified concurrent requests that recovery has ended, success or not.
func (*Chunk) IsAvailable ¶
func (*Chunk) IsBuffered ¶
func (*Chunk) IsIncomplete ¶
func (*Chunk) IsRecovering ¶
func (*Chunk) NotifyRecovered ¶
func (c *Chunk) NotifyRecovered()
NotifyRecovered notified concurrent requests that recovery has ended, success or not.
func (*Chunk) PrepareRecover ¶
PrepareRecover initiate chunk for recovery. Return true if chunk is ready for wait.
func (*Chunk) StartRecover ¶
func (c *Chunk) StartRecover()
StartRecover reset states of the winning chunk, so it is ready to start recovery
func (*Chunk) WaitRecovered ¶
func (c *Chunk) WaitRecovered()
type CommitOption ¶
type CommitOption struct {
Full bool
Snapshotted bool
BytesUploaded uint64
Checked bool
StorageSignalFlags uint32
}
func (*CommitOption) Flags ¶
func (opts *CommitOption) Flags() uint32
type Lineage ¶
type Lineage interface {
// Validate validates the lineage, it will call the IsConsistent to check if the lineage is consistent.
Validate(*LineageMeta) (LineageValidationResult, error)
// IsConsistent checks if the lineage is consistent.
IsConsistent(*LineageMeta) (bool, error)
// ClearBackup clears the backup data.
ClearBackup()
// Commit commits the lineage to the COS.
Commit() (*CommitOption, error)
// Recover recovers data from the COS by the given lineage.
Recover(*LineageMeta) (bool, <-chan error)
// Status returns the status of the lineage.
// Parameter short: returns simplified status if passes true.
Status(bool) (confirmed uint64, status LineageStatus)
}
type LineageMeta ¶
type LineageMeta struct {
*protocol.Meta
Consistent bool
Type LineageMetaType
BackupId int
BackupTotal int
MaxChunkSize uint64
Tips url.Values
}
func LineageMetaFromProtocol ¶
func LineageMetaFromProtocol(meta *protocol.Meta) (lm *LineageMeta, err error)
func (*LineageMeta) ServingKey ¶
func (meta *LineageMeta) ServingKey() string
type LineageMetaType ¶
type LineageMetaType int
const ( LineageMetaTypeMain LineageMetaType = iota LineageMetaTypeBackup LineageMetaTypeDelegate )
func (LineageMetaType) String ¶
func (t LineageMetaType) String() string
type LineageStatus ¶
func (LineageStatus) ProtocolStatus ¶
func (s LineageStatus) ProtocolStatus() protocol.Status
func (LineageStatus) ShortStatus ¶
func (s LineageStatus) ShortStatus() *protocol.ShortMeta
type LineageTerm ¶
type LineageTerm struct {
Size uint64 // Storage footprint of storing current term.
Ops []LineageOp // Operations of the term.
// Fields below will be serialized.
Term uint64 // Term id, increase on write operation.
Updates uint64 // Storage footprint of storing all terms of lineage so far.
RawOps []byte // Serialized "Ops"
Hash string // Hash value for the term.
DiffRank float64 // For snapshot only, this is supposed to be a moving value.
Buffered int // For snapshot only, number of buffered objects.
}
func LineageTermFromMeta ¶
func LineageTermFromMeta(meta *LineageMeta) *LineageTerm
type LineageValidationResult ¶
type LineageValidationResult int
const ( LineageValidationInconsistent LineageValidationResult = iota LineageValidationConsistent LineageValidationConsistentWithHistoryTerm )
func LineageValidationResultFromConsistent ¶
func LineageValidationResultFromConsistent(consistent bool) LineageValidationResult
func (LineageValidationResult) IsConsistent ¶
func (ret LineageValidationResult) IsConsistent() bool
type OpRet ¶
type OpRet struct {
// contains filtered or unexported fields
}
func OpDelayedSuccess ¶
func OpDelayedSuccess() *OpRet
func OpErrorWithMessage ¶
type OpWrapper ¶
type OpWrapper struct {
LineageOp
*OpRet
Body []byte // For safety of persistence of the SET operation in the case like DEL after SET.
Chunk *Chunk
OpIdx int
Persisted bool // Indicate the operation has been persisted.
Accessed bool // Indicate the access time should not be changed.
Sized bool // Indicate the size of storage has been updated.
}
type PersistentStorage ¶
type ServerStats ¶
type StorageMeta ¶
type StorageMeta interface {
// Capacity is physical memory allowed.
Capacity() uint64
// System is real memory used.
System() uint64
// Waterline is max memory used.
Waterline() uint64
// Effectetive is dynamic capacity calculated.
Effective() uint64
// Reserved is reserved capacity configured.
Reserved() uint64
// Size is the size stored.
Size() uint64
// Calibrate adjusts capacity after each invocation.
Calibrate()
}
Click to show internal directories.
Click to hide internal directories.