From 96e78afb1a5cc0dfed54aaa9290dae51ddda29fd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 25 Jan 2025 14:12:51 -0300 Subject: src/dedo.go: Remove Bucket.Writable() and Tx.Writable() public API --- src/dedo.go | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/dedo.go b/src/dedo.go index 8965712..592bd17 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -545,11 +545,6 @@ func newBucket(tx *Tx) Bucket { return b } -/// Bucket.Writable() returns whether the bucket is writable. -func (b *Bucket) Writable() bool { - return b.tx.writable -} - /// Bucket.Cursor() creates a cursor associated with the bucket. The cursor is /// only valid as long as the transaction is open. Do not use a cursor after /// the transaction is closed. @@ -675,7 +670,7 @@ func (b *Bucket) CreateBucketIfNotExists(key []byte) (*Bucket, error) { func (b *Bucket) DeleteBucket(key []byte) error { if b.tx.db == nil { return ErrTxClosed - } else if !b.Writable() { + } else if !b.tx.writable { return ErrTxNotWritable } @@ -746,7 +741,7 @@ func (b *Bucket) Get(key []byte) []byte { func (b *Bucket) Put(key []byte, value []byte) error { if b.tx.db == nil { return ErrTxClosed - } else if !b.Writable() { + } else if !b.tx.writable { return ErrTxNotWritable } else if len(key) == 0 { return ErrKeyRequired @@ -778,7 +773,7 @@ func (b *Bucket) Put(key []byte, value []byte) error { func (b *Bucket) Delete(key []byte) error { if b.tx.db == nil { return ErrTxClosed - } else if !b.Writable() { + } else if !b.tx.writable { return ErrTxNotWritable } @@ -807,7 +802,7 @@ func (b *Bucket) Sequence() uint64 { func (b *Bucket) SetSequence(v uint64) error { if b.tx.db == nil { return ErrTxClosed - } else if !b.Writable() { + } else if !b.tx.writable { return ErrTxNotWritable } @@ -826,7 +821,7 @@ func (b *Bucket) SetSequence(v uint64) error { func (b *Bucket) NextSequence() (uint64, error) { if b.tx.db == nil { return 0, ErrTxClosed - } else if !b.Writable() { + } else if !b.tx.writable { return 0, ErrTxNotWritable } @@ -1272,7 +1267,7 @@ func (c *Cursor) Seek(seek []byte) (key []byte, value []byte) { func (c *Cursor) Delete() error { if c.bucket.tx.db == nil { return ErrTxClosed - } else if !c.bucket.Writable() { + } else if !c.bucket.tx.writable { return ErrTxNotWritable } @@ -3371,11 +3366,6 @@ func (tx *Tx) Size() int64 { return int64(tx.meta.pgid) * int64(tx.db.pageSize) } -/// Tx.Writable() returns whether the transaction can perform write operations. -func (tx *Tx) Writable() bool { - return tx.writable -} - /// Tx.Cursor() creates a cursor associated with the root bucket. All items in /// the cursor will return a nil value because all root bucket keys point to /// buckets. The cursor is only valid as long as the transaction is open. Do -- cgit v1.2.3