Documentation
¶
Index ¶
- type ExecutorFactory
- type Lease
- func (l *Lease) CommitAndDelete(ctx context.Context) (result *cypher.ExecuteResult, err error)
- func (l *Lease) ExecuteInSession(ctx context.Context, query string, params map[string]interface{}) (result *cypher.ExecuteResult, err error)
- func (l *Lease) Release()
- func (l *Lease) Retain() *Lease
- func (l *Lease) RollbackAndDelete(ctx context.Context) error
- type Manager
- func (m *Manager) AcquireForOwner(txID, owner string) (*Lease, bool)
- func (m *Manager) Close() error
- func (m *Manager) CloseContext(ctx context.Context) error
- func (m *Manager) CommitAndDelete(ctx context.Context, session *Session) (*cypher.ExecuteResult, error)
- func (m *Manager) Delete(txID string)
- func (m *Manager) ExecuteInSession(ctx context.Context, session *Session, query string, ...) (*cypher.ExecuteResult, error)
- func (m *Manager) Get(txID string) (*Session, bool)
- func (m *Manager) GetForOwner(txID string, owner string) (*Session, bool)
- func (m *Manager) Open(ctx context.Context, dbName string) (*Session, error)
- func (m *Manager) OpenForOwner(ctx context.Context, dbName string, owner string) (*Session, error)
- func (m *Manager) OpenRequestForOwner(ctx context.Context, dbName, owner string) (*Lease, error)
- func (m *Manager) OpenRequestWithExecutorForOwner(ctx context.Context, dbName string, executor *cypher.StorageExecutor, ...) (*Lease, error)
- func (m *Manager) OpenWithExecutorForOwner(ctx context.Context, dbName string, executor *cypher.StorageExecutor, ...) (*Session, error)
- func (m *Manager) RollbackAndDelete(ctx context.Context, session *Session) error
- func (m *Manager) SetTerminalErrorObserver(observer func(*Session, error))
- func (m *Manager) Touch(session *Session)
- func (m *Manager) WaitClosed(ctx context.Context) error
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutorFactory ¶
type ExecutorFactory func(dbName string) (*cypher.StorageExecutor, error)
ExecutorFactory creates a fresh executor scoped to a database. Each explicit transaction gets its own executor instance.
type Lease ¶
type Lease struct {
Session *Session
// contains filtered or unexported fields
}
Lease serializes one request's use of a session against expiry and other requests. Release it when the request has finished using Session.
func (*Lease) CommitAndDelete ¶
CommitAndDelete commits within this request's existing admission. Release the lease after response publication; Delete would reacquire the same lease.
func (*Lease) ExecuteInSession ¶
func (l *Lease) ExecuteInSession(ctx context.Context, query string, params map[string]interface{}) (result *cypher.ExecuteResult, err error)
ExecuteInSession executes within this already-admitted request. Retain the lease through response publication, and release it only on actual completion.
func (*Lease) Release ¶
func (l *Lease) Release()
Release ends the request's exclusive use of the leased session.
func (*Lease) Retain ¶
Retain transfers another share of this accepted request's ownership to its response publisher. Each share is released on actual completion. A timeout can end one waiter while its handler or buffered publication is still active. Retain must be called before releasing the source share.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager tracks explicit transaction sessions and lifecycle operations.
func NewManager ¶
NewManager binds its lifetime parent once, before any opening work. Start/transport contexts must never replace this owner after enrollment.
func (*Manager) AcquireForOwner ¶
AcquireForOwner leases an active session to one request. Expiry is checked after the request has decoded its body, so a transaction that expires while the body is being read is reported as not found. The lease keeps an accepted request serialized with expiry and other session operations until Release.
func (*Manager) Close ¶
Close rejects new sessions, rolls back every remaining transaction, removes it from the manager and stops its expiry timer. It is safe to call repeatedly.
func (*Manager) CloseContext ¶
CloseContext rejects new sessions, rolls back every registered session once its active request has released it, and joins the manager's actual completion: rollbacks, leased requests, expiry timers and terminal observers. Every caller, first or repeated, joins the same completion and receives the same outcomes; ctx bounds only this caller's wait. A nil context is a programmer error and panics before closing admission.
func (*Manager) CommitAndDelete ¶
func (m *Manager) CommitAndDelete(ctx context.Context, session *Session) (*cypher.ExecuteResult, error)
CommitAndDelete admits and joins a legacy session terminal operation. Transports already holding a request Lease use Lease.CommitAndDelete.
func (*Manager) Delete ¶
Delete retires a forgotten session through the same terminal owner. Its legacy void API retains cleanup errors for WaitClosed.
func (*Manager) ExecuteInSession ¶
func (m *Manager) ExecuteInSession(ctx context.Context, session *Session, query string, params map[string]interface{}) (*cypher.ExecuteResult, error)
ExecuteInSession retains a legacy session operation through actual return. Transports holding an opening/request Lease use Lease.ExecuteInSession.
func (*Manager) GetForOwner ¶
func (*Manager) OpenForOwner ¶
func (*Manager) OpenRequestForOwner ¶
OpenRequestForOwner opens and leases in one admission operation. HTTP and other request transports must retain this lease through response publication; acquiring a lease after OpenForOwner leaves an idle-expiry gap.
func (*Manager) OpenRequestWithExecutorForOwner ¶
func (m *Manager) OpenRequestWithExecutorForOwner(ctx context.Context, dbName string, executor *cypher.StorageExecutor, owner string) (*Lease, error)
OpenRequestWithExecutorForOwner is the request opening contract for executors built with transport-specific authentication. It has the same lease lifetime as OpenRequestForOwner, including internal one-shot and fallback opens.
func (*Manager) OpenWithExecutorForOwner ¶
func (*Manager) RollbackAndDelete ¶
RollbackAndDelete admits and joins a legacy session rollback. An already retired session remains an idempotent no-op; WaitClosed joins late cleanup.