TableShard stores the data for one table shard in memory.
| 25 | |
| 26 | // TableShard stores the data for one table shard in memory. |
| 27 | type TableShard struct { |
| 28 | // Wait group used to prevent the stores from being prematurely deleted. |
| 29 | Users sync.WaitGroup `json:"-"` |
| 30 | |
| 31 | ShardID int `json:"-"` |
| 32 | |
| 33 | // For convenience, reference to the table schema struct. |
| 34 | Schema *common.TableSchema `json:"schema"` |
| 35 | |
| 36 | // For convenience. |
| 37 | metaStore metaCom.MetaStore |
| 38 | diskStore diskstore.DiskStore |
| 39 | options Options |
| 40 | |
| 41 | // Live store. Its locks also cover the primary key. |
| 42 | LiveStore *LiveStore `json:"liveStore"` |
| 43 | |
| 44 | // Archive store. |
| 45 | ArchiveStore *ArchiveStore `json:"archiveStore"` |
| 46 | |
| 47 | // The special column deletion lock, |
| 48 | // see https://docs.google.com/spreadsheets/d/1QI3s1_4wgP3Cy-IGoKFCx9BcN23FzIfZGRSNC8I-1Sk/edit#gid=0 |
| 49 | columnDeletion sync.Mutex |
| 50 | |
| 51 | // For convenience. |
| 52 | HostMemoryManager common.HostMemoryManager `json:"-"` |
| 53 | |
| 54 | // bootstrapLock protects BootstrapState |
| 55 | bootstrapLock sync.RWMutex |
| 56 | BootstrapState bootstrap.BootstrapState `json:"BootstrapState"` |
| 57 | |
| 58 | // BootstrapDetails shows the details of bootstrap |
| 59 | BootstrapDetails bootstrap.BootstrapDetails `json:"bootstrapDetails,omitempty"` |
| 60 | // needPeerCopy mark whether the table shard need to copy data from peer |
| 61 | // before own disk data is available for serve |
| 62 | // default to 0 (no need for peer copy) |
| 63 | needPeerCopy uint32 |
| 64 | } |
| 65 | |
| 66 | // NewTableShard creates and initiates a table shard based on the schema. |
| 67 | func NewTableShard(schema *common.TableSchema, metaStore metaCom.MetaStore, |
nothing calls this directly
no outgoing calls
no test coverage detected