Ejemplo n.º 1
0
func NewETCDHelper(serializationFormat *format.Format, cryptor encryption.Cryptor, client etcd.StoreClient, clock clock.Clock) *ETCDHelper {
	logger := lagertest.NewTestLogger("etcd-helper")

	return &ETCDHelper{
		client:     client,
		format:     serializationFormat,
		serializer: format.NewSerializer(cryptor),
		logger:     logger,
		clock:      clock,
	}
}
Ejemplo n.º 2
0
func NewETCD(
	serializationFormat *format.Format,
	convergenceWorkersSize int,
	updateWorkersSize int,
	desiredLRPCreationTimeout time.Duration,
	cryptor encryption.Cryptor,
	storeClient StoreClient,
	clock clock.Clock,
) *ETCDDB {
	return &ETCDDB{
		format:                    serializationFormat,
		convergenceWorkersSize:    convergenceWorkersSize,
		updateWorkersSize:         updateWorkersSize,
		desiredLRPCreationTimeout: desiredLRPCreationTimeout,
		serializer:                format.NewSerializer(cryptor),
		cryptor:                   cryptor,
		client:                    storeClient,
		clock:                     clock,
		inflightWatches:           map[chan bool]bool{},
		inflightWatchLock:         &sync.Mutex{},
	}
}
Ejemplo n.º 3
0
func NewSQLDB(
	db *sql.DB,
	convergenceWorkersSize int,
	updateWorkersSize int,
	serializationFormat *format.Format,
	cryptor encryption.Cryptor,
	guidProvider guidprovider.GUIDProvider,
	clock clock.Clock,
	flavor string,
) *SQLDB {
	return &SQLDB{
		db: db,
		convergenceWorkersSize: convergenceWorkersSize,
		updateWorkersSize:      updateWorkersSize,
		clock:                  clock,
		format:                 serializationFormat,
		guidProvider:           guidProvider,
		serializer:             format.NewSerializer(cryptor),
		cryptor:                cryptor,
		encoder:                format.NewEncoder(cryptor),
		flavor:                 flavor,
	}
}
func (a *AddCachedDependencies) SetCryptor(cryptor encryption.Cryptor) {
	a.serializer = format.NewSerializer(cryptor)
}
Ejemplo n.º 5
0
		task = model_helpers.NewValidTask("a-guid")
		logger = lagertest.NewTestLogger("test")
		cryptor = &encryptionfakes.FakeCryptor{}
		cryptor.EncryptStub = func(plaintext []byte) (encryption.Encrypted, error) {
			nonce := [12]byte{}
			return encryption.Encrypted{
				KeyLabel:   "label",
				Nonce:      nonce[:],
				CipherText: plaintext,
			}, nil
		}
		cryptor.DecryptStub = func(ciphered encryption.Encrypted) ([]byte, error) {
			return ciphered.CipherText, nil
		}
		encoder = format.NewEncoder(cryptor)
		serializer = format.NewSerializer(cryptor)
	})

	Describe("Marshal", func() {
		Describe("LEGACY_FORMATTING", func() {
			It("marshals the data as-is without an envelope", func() {
				jsonEncodedTask, err := json.Marshal(task)
				Expect(err).NotTo(HaveOccurred())

				encoded, err := serializer.Marshal(logger, format.LEGACY_FORMATTING, task)
				Expect(err).NotTo(HaveOccurred())
				Expect(encoded).To(MatchJSON(jsonEncodedTask))
			})
		})

		Describe("FORMATTED_JSON", func() {
func (e *AddPlacementTagsToDesiredLRPs) SetCryptor(cryptor encryption.Cryptor) {
	e.serializer = format.NewSerializer(cryptor)
}
func (m *SplitDesiredLRP) SetCryptor(cryptor encryption.Cryptor) {
	m.serializer = format.NewSerializer(cryptor)
}
func (e *IncreaseRunInfoColumnSize) SetCryptor(cryptor encryption.Cryptor) {
	e.serializer = format.NewSerializer(cryptor)
}
func (b *Base64ProtobufEncode) SetCryptor(cryptor encryption.Cryptor) {
	b.serializer = format.NewSerializer(cryptor)
}
func (b *TimeoutToMilliseconds) SetCryptor(cryptor encryption.Cryptor) {
	b.serializer = format.NewSerializer(cryptor)
}
func (e *IncreaseErrorColumnsSize) SetCryptor(cryptor encryption.Cryptor) {
	e.serializer = format.NewSerializer(cryptor)
}
func (e *AddMaxPidsToDesiredLRPs) SetCryptor(cryptor encryption.Cryptor) {
	e.serializer = format.NewSerializer(cryptor)
}
Ejemplo n.º 13
0
func (e *ETCDToSQL) SetCryptor(cryptor encryption.Cryptor) {
	e.serializer = format.NewSerializer(cryptor)
}