-
Notifications
You must be signed in to change notification settings - Fork 38
/
messages.go
75 lines (56 loc) · 1.93 KB
/
messages.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2015 Western Digital Corporation or its affiliates. All rights reserved.
// SPDX-License-Identifier: MIT
package core
import "time"
// This file contains common structs that are used as parts of other messages.
// TractInfo describes one tract and where to find it.
type TractInfo struct {
// The unique ID for the tract.
Tract TractID
// Latest version known to Curator.
// Used to detect stale versions from failed tractservers.
Version int
// ==== for REPLICATED storage class:
// List of tractservers serving this tract. Maybe be stale.
Hosts []string
// The corresponding tractserver IDs.
TSIDs []TractserverID
// ==== for RS_X classes:
// Pointer to the tract encoded in an RS chunk.
RS TractPointer
}
// BlobInfo is information about a blob, analogous to os.FileInfo.
type BlobInfo struct {
// What is the replication factor of this blob? (REPLICATED storage class only)
Repl int
// How many tracts make up the blob?
NumTracts int
// When was the blob last written/read?
MTime, ATime time.Time
// How is this blob stored?
Class StorageClass
// How did the client hint that this should be stored?
Hint StorageHint
// Time after which this blob can be automatically deleted by the system.
Expires time.Time
}
// TractPointer is a reference to a tract embedded in an RS chunk.
type TractPointer struct {
Chunk RSChunkID
Host string
TSID TractserverID
Offset uint32
Length uint32
// Metadata for client-side reconstruction. These are parallel lists
// containing the location of the other pieces of data that this tract was
// coded with. Hosts that are known to be down may have "" / 0. If Class is
// 0 (REPLICATED), OtherHosts/TSIDs are not valid (should be empty).
Class StorageClass
BaseChunk RSChunkID
OtherHosts []string
OtherTSIDs []TractserverID
}
// Present returns true if this TractPointer is not the zero value.
func (tp *TractPointer) Present() bool {
return tp.TSID != 0
}