goes/storage/storage.go
2016-08-28 13:29:53 -07:00

28 lines
590 B
Go

package storage
import (
"github.com/satori/go.uuid"
"time"
)
const IntegerSizeInBytes = 8
const StreamStartingCapacity = 512
type StoredEvent struct {
StreamId uuid.UUID
CreationTime time.Time
TypeId string
Data []byte
MetadataTypeId string
Metadata []byte
}
//TODO: performance - change reads array for some kind of iterator
type Storage interface {
Write(event *StoredEvent) error
ReadStream(streamId uuid.UUID) ([]*StoredEvent, error)
ReadAll() ([]*StoredEvent, error)
StreamVersion(streamId uuid.UUID) (uint32, error)
RebuildTypeIndexes()
}