func (decryptor *PgDecryptor) ResetZoneMatch() {
	if decryptor.zoneMatcher != nil {
		decryptor.zoneMatcher.Reset()
	}
}
ResetZoneMatch resets zone matcher
package postgresql
import (
	"bytes"
	"context"
	"encoding/hex"
	"errors"
	"io"
	"io/ioutil"
	"os"
	"github.com/cossacklabs/acra/decryptor/base"
	"github.com/cossacklabs/acra/decryptor/binary"
	"github.com/cossacklabs/acra/keystore"
	"github.com/cossacklabs/acra/logging"
	"github.com/cossacklabs/acra/utils"
	"github.com/cossacklabs/acra/zone"
	"github.com/cossacklabs/themis/gothemis/keys"
	log "github.com/sirupsen/logrus"
	"go.opencensus.io/trace"
)
var errPlainData = errors.New("plain data without AcraStruct signature")
type PgDecryptor struct {
	isWithZone         bool
	isWholeMatch       bool
	keyStore           keystore.DecryptionKeyStore
	zoneMatcher        *zone.Matcher
	binaryDecryptor    base.DataDecryptor
	checkPoisonRecords bool
	clientID             []byte
	matchBuffer          []byte
	matchIndex           int
	callbackStorage      *base.PoisonCallbackStorage
	logger               *log.Entry
	dataProcessor        base.DataProcessor
	dataProcessorContext *base.DataProcessorContext
}
func NewPgDecryptor(clientID []byte, decryptor base.DataDecryptor, withZone bool, keystore keystore.DecryptionKeyStore) *PgDecryptor {
	logger := log.WithField("client_id", string(clientID))
	decryptor.SetLogger(logger)
	return &PgDecryptor{
		isWithZone:      withZone,
		binaryDecryptor: binary.NewBinaryDecryptor(logger),
		clientID:        clientID,
		matchBuffer:          make([]byte, len(EscapeTagBegin)+len(base.TagBegin)),
		matchIndex:           0,
		isWholeMatch:         true,
		logger:               logger,
		checkPoisonRecords:   true,
		keyStore:             keystore,
		dataProcessorContext: base.NewDataProcessorContext(clientID, withZone, keystore).UseContext(logging.SetLoggerToContext(context.Background(), logger)),
	}
}
func (decryptor *PgDecryptor) SetClientID(clientID []byte) {
	decryptor.clientID = clientID
	decryptor.dataProcessorContext.ClientID = clientID
}
func (decryptor *PgDecryptor) SetLogger(logger *log.Entry) {
	decryptor.binaryDecryptor.SetLogger(logger)
}
func (decryptor *PgDecryptor) SetWithZone(b bool) {
	decryptor.isWithZone = b
}
func (decryptor *PgDecryptor) SetZoneMatcher(zoneMatcher *zone.Matcher) {
	decryptor.zoneMatcher = zoneMatcher
}
func (decryptor *PgDecryptor) GetZoneMatcher() *zone.Matcher {
	return decryptor.zoneMatcher
}
func (decryptor *PgDecryptor) IsMatchedZone() bool {
	return decryptor.zoneMatcher.IsMatched() && decryptor.keyStore.HasZonePrivateKey(decryptor.zoneMatcher.GetZoneID())
}
func (decryptor *PgDecryptor) MatchZone(b byte) bool {
	return decryptor.zoneMatcher.Match(b)
}
func (decryptor *PgDecryptor) GetMatchedZoneID() []byte {
	if decryptor.IsWithZone() {
		return decryptor.zoneMatcher.GetZoneID()
	}
	return nil
}