-
Notifications
You must be signed in to change notification settings - Fork 38
/
tractserver_talker.go
35 lines (26 loc) · 1.5 KB
/
tractserver_talker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2015 Western Digital Corporation or its affiliates. All rights reserved.
// SPDX-License-Identifier: MIT
package blb
import (
"context"
"github.com/westerndigitalcorporation/blb/internal/core"
)
// TractserverTalker manages connections to tractservers.
type TractserverTalker interface {
// Create creates a new tract on the tractserver and does a write to the
// newly created tract.
Create(ctx context.Context, addr string, tsid core.TractserverID, id core.TractID, b []byte, off int64) core.Error
// Write does a write to a tract on this tractserver.
Write(ctx context.Context, addr string, id core.TractID, version int, b []byte, off int64) core.Error
// Read reads from a tract.
Read(ctx context.Context, addr string, id core.TractID, version int, len int, off int64) ([]byte, core.Error)
// ReadInto reads from a tract. It will try to read up to len(b) bytes and put them in b.
// It returns the number of bytes read, as in io.Reader's Read.
ReadInto(ctx context.Context, addr string, id core.TractID, version int, b []byte, off int64) (int, core.Error)
// StatTract returns the number of bytes in a tract.
StatTract(ctx context.Context, addr string, id core.TractID, version int) (int64, core.Error)
// GetDiskInfo returns a summary of disk info.
GetDiskInfo(ctx context.Context, addr string) ([]core.FsStatus, core.Error)
// SetControlFlags changes control flags for a disk.
SetControlFlags(ctx context.Context, addr string, root string, flags core.DiskControlFlags) core.Error
}