blob

package
v0.0.0-...-e89a0ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockListTag     = "BlockList"
	BlockLatest      = "Latest"
	BlockCommitted   = "Committed"
	BlockUncommitted = "Uncommitted"
	BlockAll         = "All"
)
View Source
const BgSaveInterval = 30 * time.Second
View Source
const BlockReadCacheSize = 16
View Source
const DefaultConcurrency = 8
View Source
const IndexFileName = "__blob_index.json"
View Source
const MaxCacheBlockSize = 16 * 1024 * 1024 // 16M
View Source
const ProxyStartTimeout = 10 * time.Second
View Source
const ReqIDHeader = "X-Ms-Request-Id"
View Source
const SQLServerCompressionMethod = "sqlserver"

Variables

View Source
var ErrBadRequest = errors.New("invalid request")
View Source
var ErrNoLease = errors.New("no lease")
View Source
var ErrNotFound = errors.New("object not found")

Functions

func NewSkipReader

func NewSkipReader(r io.Reader, offset uint64) io.Reader

func SerializeBlocklistXML

func SerializeBlocklistXML(bl *XBlockListOut) ([]byte, error)

func UseBuiltinCompression

func UseBuiltinCompression() bool

Types

type Block

type Block struct {
	ID            string `json:"id"`
	Offset        uint64 `json:"of"`
	UploadedSize  uint64 `json:"us"`
	UploadedRev   uint   `json:"ur"`
	CommittedSize uint64 `json:"cs"`
	CommittedRev  uint   `json:"cr"`
}

type DebugResponseWriter

type DebugResponseWriter struct {
	// contains filtered or unexported fields
}

func (*DebugResponseWriter) Header

func (drw *DebugResponseWriter) Header() http.Header

func (*DebugResponseWriter) Write

func (drw *DebugResponseWriter) Write(b []byte) (int, error)

func (*DebugResponseWriter) WriteHeader

func (drw *DebugResponseWriter) WriteHeader(s int)

type Index

type Index struct {
	sync.Mutex

	Size        uint64   `json:"size"`
	Blocks      []*Block `json:"blocks"`
	Compression string   `json:"compression"`
	Encryption  string   `json:"encryption"`
	// contains filtered or unexported fields
}

func NewIndex

func NewIndex(f storage.Folder) *Index

func (*Index) Clear

func (idx *Index) Clear() []string

func (*Index) GetBlockList

func (idx *Index) GetBlockList(ltype string) *XBlockListOut

func (*Index) GetSections

func (idx *Index) GetSections(rangeMin, rangeMax uint64) []Section

func (*Index) Load

func (idx *Index) Load() error

func (*Index) PutBlock

func (idx *Index) PutBlock(id string, size uint64) string

func (*Index) PutBlockList

func (idx *Index) PutBlockList(xblocklist *XBlockListIn) ([]string, error)

nolint: funlen,gocyclo

func (*Index) Save

func (idx *Index) Save() error

func (*Index) SaveDelayed

func (idx *Index) SaveDelayed()

type Lease

type Lease struct {
	ID  string
	End time.Time
}

type Section

type Section struct {
	Path      string
	Offset    uint64
	Limit     uint64
	BlockSize uint64
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(folder storage.Folder) (*Server, error)

func (*Server) AcquireLock

func (bs *Server) AcquireLock() (io.Closer, error)

func (*Server) HandleAcquireLease

func (bs *Server) HandleAcquireLease(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlob

func (bs *Server) HandleBlob(w http.ResponseWriter, req *http.Request)

Index operations

func (*Server) HandleBlobDelete

func (bs *Server) HandleBlobDelete(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlobGet

func (bs *Server) HandleBlobGet(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlobHead

func (bs *Server) HandleBlobHead(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlobPut

func (bs *Server) HandleBlobPut(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlock

func (bs *Server) HandleBlock(w http.ResponseWriter, req *http.Request)

Block operations

func (*Server) HandleBlockList

func (bs *Server) HandleBlockList(w http.ResponseWriter, req *http.Request)

BlockList operations

func (*Server) HandleBlockListGet

func (bs *Server) HandleBlockListGet(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlockListPut

func (bs *Server) HandleBlockListPut(w http.ResponseWriter, req *http.Request)

func (*Server) HandleBlockPut

func (bs *Server) HandleBlockPut(w http.ResponseWriter, req *http.Request)

func (*Server) HandleChangeLease

func (bs *Server) HandleChangeLease(w http.ResponseWriter, req *http.Request)

func (*Server) HandleLease

func (bs *Server) HandleLease(w http.ResponseWriter, req *http.Request)

Lease operations

func (*Server) HandleReleaseLease

func (bs *Server) HandleReleaseLease(w http.ResponseWriter, req *http.Request)

func (*Server) HandleRenewLease

func (bs *Server) HandleRenewLease(w http.ResponseWriter, req *http.Request)

func (*Server) Run

func (bs *Server) Run(ctx context.Context) error

func (*Server) RunBackground

func (bs *Server) RunBackground(ctx context.Context, cancel context.CancelFunc) error

func (*Server) ServeHTTP

func (bs *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) ServeHTTP2

func (bs *Server) ServeHTTP2(w http.ResponseWriter, req *http.Request)

func (*Server) Shutdown

func (bs *Server) Shutdown() error

func (*Server) WaitReady

func (bs *Server) WaitReady(ctx context.Context, timeout time.Duration) error

type SkipReader

type SkipReader struct {
	// contains filtered or unexported fields
}

func (*SkipReader) Read

func (r *SkipReader) Read(s []byte) (int, error)

type XBlockIn

type XBlockIn struct {
	ID   string
	Mode string
}

func (*XBlockIn) MarshalXML

func (b *XBlockIn) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*XBlockIn) UnmarshalXML

func (b *XBlockIn) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type XBlockListIn

type XBlockListIn struct {
	Blocks []XBlockIn
}

func ParseBlocklistXML

func ParseBlocklistXML(data []byte) (*XBlockListIn, error)

func (*XBlockListIn) MarshalXML

func (bl *XBlockListIn) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*XBlockListIn) UnmarshalXML

func (bl *XBlockListIn) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type XBlockListOut

type XBlockListOut struct {
	XMLName         xml.Name `xml:"BlockList"`
	CommittedBlocks struct {
		Blocks []XBlockOut
	}
	UncommittedBlocks struct {
		Blocks []XBlockOut
	}
}

type XBlockOut

type XBlockOut struct {
	XMLName xml.Name `xml:"Block"`
	Name    string
	Size    uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL