예제 #1
0
func getScanConfiguration(a httpRequestArgs) (*scanConfigImpl, errors.Error) {

	scan_consistency_field, err := a.getString(SCAN_CONSISTENCY, "NOT_BOUNDED")
	if err != nil {
		return nil, err
	}

	scan_level := newScanConsistency(scan_consistency_field)
	if scan_level == server.UNDEFINED_CONSISTENCY {
		return nil, errors.NewServiceErrorUnrecognizedValue(SCAN_CONSISTENCY, scan_consistency_field)
	}

	scan_wait, err := a.getDuration(SCAN_WAIT)
	if err != nil {
		return nil, err
	}

	scan_vector, err := a.getScanVector()
	if err != nil {
		return nil, err
	}

	if scan_level == server.AT_PLUS && scan_vector == nil {
		return nil, errors.NewServiceErrorMissingValue(SCAN_VECTOR)
	}

	return &scanConfigImpl{
		scan_level:  scan_level,
		scan_wait:   scan_wait,
		scan_vector: scan_vector,
	}, nil
}
예제 #2
0
func getScanConfiguration(a httpRequestArgs) (*scanConfigImpl, errors.Error) {

	scan_consistency_field, err := a.getString(SCAN_CONSISTENCY, "NOT_BOUNDED")
	if err != nil {
		return nil, err
	}

	scan_level := newScanConsistency(scan_consistency_field)
	if scan_level == server.UNDEFINED_CONSISTENCY {
		return nil, errors.NewServiceErrorUnrecognizedValue(SCAN_CONSISTENCY, scan_consistency_field)
	}

	scan_wait, err := a.getDuration(SCAN_WAIT)
	if err != nil {
		return nil, err
	}

	scan_vector, err := a.getScanVector()
	if err != nil {
		return nil, err
	}

	scan_vectors, err := a.getScanVectors()
	if err != nil {
		return nil, err
	}

	var scan_vector_source timestamp.ScanVectorSource
	if scan_vector == nil {
		if scan_vectors == nil {
			if scan_level == server.AT_PLUS && scan_vector == nil && scan_vectors == nil {
				return nil, errors.NewServiceErrorMissingValue(SCAN_VECTOR)
			}
			scan_vector_source = &ZeroScanVectorSource{}
		} else {
			defaultNamespace, err := a.getString(NAMESPACE, "default")
			if err != nil {
				return nil, err
			}
			scan_vector_source = newMultipleScanVectorSource(defaultNamespace, scan_vectors)
		}
	} else {
		if scan_vectors == nil {
			scan_vector_source = &singleScanVectorSource{scan_vector: scan_vector}
		} else {
			// Not both scan_vector and scan_vectors.
			return nil, errors.NewServiceErrorMultipleValues("scan_vector and scan_vectors")
		}
	}

	return &scanConfigImpl{
		scan_level:         scan_level,
		scan_wait:          scan_wait,
		scan_vector_source: scan_vector_source,
	}, nil
}
예제 #3
0
func getFormat(a httpRequestArgs) (Format, errors.Error) {
	var format Format

	format_field, err := a.getString(FORMAT, "JSON")
	if err == nil && format_field != "" {
		format = newFormat(format_field)
		if format == UNDEFINED_FORMAT {
			err = errors.NewServiceErrorUnrecognizedValue(FORMAT, format_field)
		}
	}
	return format, err
}
예제 #4
0
func getEncoding(a httpRequestArgs) (Encoding, errors.Error) {
	var encoding Encoding

	encoding_field, err := a.getString(ENCODING, "UTF-8")
	if err == nil && encoding_field != "" {
		encoding = newEncoding(encoding_field)
		if encoding == UNDEFINED_ENCODING {
			err = errors.NewServiceErrorUnrecognizedValue(ENCODING, encoding_field)
		}
	}
	return encoding, err
}
예제 #5
0
func getCompression(a httpRequestArgs) (Compression, errors.Error) {
	var compression Compression

	compression_field, err := a.getString(COMPRESSION, "NONE")
	if err == nil && compression_field != "" {
		compression = newCompression(compression_field)
		if compression == UNDEFINED_COMPRESSION {
			err = errors.NewServiceErrorUnrecognizedValue(COMPRESSION, compression_field)
		}
	}
	return compression, err
}