net

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package net provides gini/inter interface variants adapted to network communications.

Package net mirrors gini/inter but adds error conditions to methods for the case where the implementer needs to check for network/os errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adder

type Adder interface {
	Add(m z.Lit) error
}

type Assumable

type Assumable interface {
	Assume(m ...z.Lit) error
	Why(dst []z.Lit) ([]z.Lit, error)
}

type GoSolvable

type GoSolvable interface {
	GoSolve() Solve
}

type Model

type Model interface {
	Value(m z.Lit) (bool, error)
}

type S

type S interface {
	Add(m z.Lit) error
	Solvable
	GoSolvable
	Model
	Assumable
}

Interface NetS composes solving, asynchronous interface, model extraction, assumptions, and scoping with error returns for net operations.

func ToS

func ToS(s inter.S) S

ToNetS wraps an S making it return nil errors to conform to the NetS interface.

type Solvable

type Solvable interface {
	Solve() (result int, err error)
}

type Solve

type Solve interface {
	Test() (int, bool, error)
	Try(d time.Duration) (int, error)
	Stop() (int, error)
}

Interface NetSolve represents an asynchronous connection to a call to solve over a network, such as crisp.(*Client).Solve(). It is analagous to gini.Solve, but adds error returns for underlying network/operating system errors.

NetSolve may be constructed by a call to crisp.(*Client).GoSolve().

This interface is NOT safe for usage in multiple goroutines and the following caveats must be respected:

  1. Once any method of NetSolve returns a result from the underlying solver NetSolve must no longer be used
  2. Once any method of a NetSolve returns a non-nil error, it must no longer be used.

func ToSolve

func ToSolve(s inter.Solve) Solve

ToNetSolve wraps a Solve to make a conforming NetSolve, where all errors are nil

type Testable

type Testable interface {
	Test(dst []z.Lit) (result int, out []z.Lit, err error)
	Untest() (int, error)
	Reasons(rs []z.Lit, implied z.Lit) ([]z.Lit, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL