MCPcopy
hub / github.com/apache/casbin / GetBufferedModel

Method GetBufferedModel

transaction.go:384–393  ·  view source on GitHub ↗

GetBufferedModel returns the model as it would look after applying all buffered operations. This is useful for preview or validation purposes within the transaction.

()

Source from the content-addressed store, hash-verified

382// GetBufferedModel returns the model as it would look after applying all buffered operations.
383// This is useful for preview or validation purposes within the transaction.
384func (tx *Transaction) GetBufferedModel() (model.Model, error) {
385 tx.mutex.RLock()
386 defer tx.mutex.RUnlock()
387
388 if err := tx.checkTransactionStatus(); err != nil {
389 return nil, err
390 }
391
392 return tx.buffer.ApplyOperationsToModel(tx.buffer.GetModelSnapshot())
393}
394
395// HasOperations returns true if the transaction has any buffered operations.
396func (tx *Transaction) HasOperations() bool {

Callers 1

TestTransactionBufferFunction · 0.80

Calls 3

GetModelSnapshotMethod · 0.80

Tested by 1

TestTransactionBufferFunction · 0.64