diff options
author | EuAndreh <eu@euandre.org> | 2025-01-25 21:00:13 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-01-25 21:00:13 -0300 |
commit | 5f0c78dedbbec2be4c2c7aff47315dc1e5d3d001 (patch) | |
tree | 6229f7faff0c154ce40d2896c9608192107ffba7 | |
parent | src/dedo.go: Remove Tx.CopyFile() and Tx.Page() public functions (diff) | |
download | dedo-5f0c78dedbbec2be4c2c7aff47315dc1e5d3d001.tar.gz dedo-5f0c78dedbbec2be4c2c7aff47315dc1e5d3d001.tar.xz |
src/dedo.go: Remove public PageInfo type
-rw-r--r-- | src/dedo.go | 8 | ||||
-rw-r--r-- | tests/dedo.go | 46 |
2 files changed, 27 insertions, 27 deletions
diff --git a/src/dedo.go b/src/dedo.go index 27dfc4d..66919f0 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -250,14 +250,6 @@ type leafPageElement struct { vsize uint32 } -/// PageInfo represents human readable information about a page. -type PageInfo struct { - ID int - Type string - Count int - OverflowCount int -} - type pgids []pgid /// txid represents the internal transaction identifier. diff --git a/tests/dedo.go b/tests/dedo.go index d479b4c..9c541b7 100644 --- a/tests/dedo.go +++ b/tests/dedo.go @@ -31,6 +31,14 @@ import ( +// pageInfoT represents human readable information about a page. +type pageInfoT struct{ + id int + type_ string + count int + overflowCount int +} + /// Tx.copyFile() copies the entire database to file at the given path. A /// reader transaction is maintained during the copy so it is safe to continue /// using the database while a copy is in progress. @@ -51,7 +59,7 @@ func (tx *Tx) copyFile(path string, mode os.FileMode) error { /// Tx.Page() returns page information for a given page number. This is only /// safe for concurrent use when used by a writable transaction. -func (tx *Tx) pageInfo(id int) (*PageInfo, error) { +func (tx *Tx) pageInfo(id int) (*pageInfoT, error) { if tx.db == nil { return nil, ErrTxClosed } else if pgid(id) >= tx.meta.pgid { @@ -60,17 +68,17 @@ func (tx *Tx) pageInfo(id int) (*PageInfo, error) { // Build the page info. p := tx.db.page(pgid(id)) - info := &PageInfo{ - ID: id, - Count: int(p.count), - OverflowCount: int(p.overflow), + info := &pageInfoT{ + id: id, + count: int(p.count), + overflowCount: int(p.overflow), } // Determine the type (of if it's free). if tx.db.freelist.freed(pgid(id)) { - info.Type = "free" + info.type_ = "free" } else { - info.Type = p.typ() + info.type_ = p.typ() } return info, nil @@ -3582,43 +3590,43 @@ func TestDB_Consistency(t *testing.T) { p, _ := tx.pageInfo(0) if p == nil { t.Fatal("expected page") - } else if p.Type != "meta" { - t.Fatalf("unexpected page type: %s", p.Type) + } else if p.type_ != "meta" { + t.Fatalf("unexpected page type: %s", p.type_) } p, _ = tx.pageInfo(1) if p == nil { t.Fatal("expected page") - } else if p.Type != "meta" { - t.Fatalf("unexpected page type: %s", p.Type) + } else if p.type_ != "meta" { + t.Fatalf("unexpected page type: %s", p.type_) } p, _ = tx.pageInfo(2) if p == nil { t.Fatal("expected page") - } else if p.Type != "free" { - t.Fatalf("unexpected page type: %s", p.Type) + } else if p.type_ != "free" { + t.Fatalf("unexpected page type: %s", p.type_) } p, _ = tx.pageInfo(3) if p == nil { t.Fatal("expected page") - } else if p.Type != "free" { - t.Fatalf("unexpected page type: %s", p.Type) + } else if p.type_ != "free" { + t.Fatalf("unexpected page type: %s", p.type_) } p, _ = tx.pageInfo(4) if p == nil { t.Fatal("expected page") - } else if p.Type != "leaf" { - t.Fatalf("unexpected page type: %s", p.Type) + } else if p.type_ != "leaf" { + t.Fatalf("unexpected page type: %s", p.type_) } p, _ = tx.pageInfo(5) if p == nil { t.Fatal("expected page") - } else if p.Type != "freelist" { - t.Fatalf("unexpected page type: %s", p.Type) + } else if p.type_ != "freelist" { + t.Fatalf("unexpected page type: %s", p.type_) } p, _ = tx.pageInfo(6) |