Documentation
¶
Index ¶
- type SessionStore
- func (s *SessionStore) CleanupOldSessions(maxAge time.Duration) error
- func (s *SessionStore) DeleteSession(path string) error
- func (s *SessionStore) GetMissingChunks(path string) ([]int, error)
- func (s *SessionStore) GetOrCreateSession(path string, totalChunks, chunkSize int) (*UploadSession, error)
- func (s *SessionStore) GetSession(path string) (*UploadSession, bool)
- func (s *SessionStore) MarkChunkReceived(path string, chunkID int) error
- type UploadSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore manages upload sessions with persistence
func NewSessionStore ¶
func NewSessionStore(metaDir string) (*SessionStore, error)
NewSessionStore creates a new session store
func (*SessionStore) CleanupOldSessions ¶
func (s *SessionStore) CleanupOldSessions(maxAge time.Duration) error
CleanupOldSessions removes sessions older than the specified duration
func (*SessionStore) DeleteSession ¶
func (s *SessionStore) DeleteSession(path string) error
DeleteSession removes a completed session
func (*SessionStore) GetMissingChunks ¶
func (s *SessionStore) GetMissingChunks(path string) ([]int, error)
GetMissingChunks returns a list of chunk IDs that haven't been received
func (*SessionStore) GetOrCreateSession ¶
func (s *SessionStore) GetOrCreateSession(path string, totalChunks, chunkSize int) (*UploadSession, error)
GetOrCreateSession gets an existing session or creates a new one
func (*SessionStore) GetSession ¶
func (s *SessionStore) GetSession(path string) (*UploadSession, bool)
GetSession retrieves a session by path
func (*SessionStore) MarkChunkReceived ¶
func (s *SessionStore) MarkChunkReceived(path string, chunkID int) error
MarkChunkReceived marks a chunk as received
type UploadSession ¶
type UploadSession struct {
Path string `json:"path"` // destination path
TotalChunks int `json:"total_chunks"` // expected number of chunks
ChunkSize int `json:"chunk_size"` // size of each chunk
FileHash string `json:"file_hash"` // SHA-256 of complete file (optional)
ReceivedMap []bool `json:"received_map"` // bitmap of received chunks
CreatedAt time.Time `json:"created_at"` // when upload started
LastModified time.Time `json:"last_modified"` // last chunk received
Completed bool `json:"completed"` // upload completed
}
UploadSession tracks the state of a partial upload
Click to show internal directories.
Click to hide internal directories.