idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
42,600 | private Retrofit . Builder setEndpoint ( Retrofit . Builder retrofitBuilder , String endpoint ) { if ( endpoint != null ) { return retrofitBuilder . baseUrl ( endpoint ) ; } return retrofitBuilder ; } | Configures CMA core endpoint . | 46 | 7 |
42,601 | public CMAContentType addField ( CMAField field ) { if ( fields == null ) { fields = new ArrayList < CMAField > ( ) ; } fields . add ( field ) ; return this ; } | Adds a new field . | 46 | 5 |
42,602 | public CMAArray < CMAApiKey > fetchAll ( Map < String , String > query ) { throwIfEnvironmentIdIsSet ( ) ; return fetchAll ( spaceId , query ) ; } | Query for specific api keys from the configured space . | 42 | 10 |
42,603 | public CMAApiKey update ( CMAApiKey key ) { assertNotNull ( key , "key" ) ; final String keyId = getResourceIdOrThrow ( key , "key" ) ; final String spaceId = getSpaceIdOrThrow ( key , "key" ) ; final Integer version = getVersionOrThrow ( key , "update" ) ; final CMASystem system = key . getSystem ( ) ; key . setSystem... | Updates a delivery api key from the configured space . | 204 | 11 |
42,604 | public CMAApiKey create ( String spaceId , CMAApiKey key ) { assertNotNull ( spaceId , "spaceId" ) ; assertNotNull ( key , "key" ) ; return service . create ( spaceId , key ) . blockingFirst ( ) ; } | Create a new delivery api key . | 59 | 7 |
42,605 | public int delete ( CMAApiKey key ) { assertNotNull ( key , "key" ) ; final String space = getSpaceIdOrThrow ( key , "key" ) ; final String id = getResourceIdOrThrow ( key , "key" ) ; return service . delete ( space , id ) . blockingFirst ( ) . code ( ) ; } | Delete a given api key from the configured space . | 76 | 10 |
42,606 | static byte [ ] readAllBytes ( InputStream stream ) throws IOException { int bytesRead = 0 ; byte [ ] currentChunk = new byte [ 255 ] ; final List < byte [ ] > chunks = new ArrayList < byte [ ] > ( ) ; while ( ( bytesRead = stream . read ( currentChunk ) ) != - 1 ) { chunks . add ( copyOf ( currentChunk , bytesRead ) )... | Tries to read all content from a give stream . | 201 | 11 |
42,607 | public int delete ( CMAUpload upload ) { final String uploadId = getResourceIdOrThrow ( upload , "upload" ) ; final String spaceId = getSpaceIdOrThrow ( upload , "upload" ) ; final Response < Void > response = service . delete ( spaceId , uploadId ) . blockingFirst ( ) ; return response . code ( ) ; } | Delete a given upload again . | 77 | 6 |
42,608 | public CMAArray < CMARole > fetchAll ( Map < String , String > query ) { throwIfEnvironmentIdIsSet ( ) ; return fetchAll ( spaceId , query ) ; } | Fetch specific roles of the configured space . | 41 | 9 |
42,609 | @ Override public Response intercept ( Chain chain ) throws IOException { final Request request = chain . request ( ) ; return chain . proceed ( request . newBuilder ( ) . addHeader ( name , value ) . build ( ) ) ; } | Method called by framework to enrich current request chain with requested header information . | 50 | 14 |
42,610 | public CMAWebhook addTopic ( CMAWebhookTopic topic ) { if ( this . topics == null ) { this . topics = new ArrayList < CMAWebhookTopic > ( ) ; } this . topics . add ( topic ) ; return this ; } | Add a topic this webhook should be triggered on . | 56 | 11 |
42,611 | public CMAWebhook addHeader ( String key , String value ) { if ( this . headers == null ) { this . headers = new ArrayList < CMAWebhookHeader > ( ) ; } this . headers . add ( new CMAWebhookHeader ( key , value ) ) ; return this ; } | Adds a custom http header to the call done by this webhook . | 65 | 14 |
42,612 | public CMAWebhook setBasicAuthorization ( String user , String password ) { this . user = user ; this . password = password ; return this ; } | Set authorization parameter for basic HTTP authorization on the url to be called by this webhook . | 33 | 18 |
42,613 | public void close ( ) { Closeable closable = getClosable ( ) ; try { LOG . closingResponse ( this ) ; closable . close ( ) ; LOG . successfullyClosedResponse ( this ) ; } catch ( IOException e ) { throw LOG . exceptionWhileClosingResponse ( e ) ; } } | Implements the default close behavior | 67 | 7 |
42,614 | public static SearchSortGeoDistance sortGeoDistance ( double locationLon , double locationLat , String field ) { return new SearchSortGeoDistance ( locationLon , locationLat , field ) ; } | Sort by geo location . | 44 | 5 |
42,615 | public List < InetAddress > nodes ( ) { List < InetAddress > allNodes = new ArrayList < InetAddress > ( ) ; BucketConfig config = bucketConfig . get ( ) ; for ( NodeInfo nodeInfo : config . nodes ( ) ) { try { allNodes . add ( InetAddress . getByName ( nodeInfo . hostname ( ) . address ( ) ) ) ; } catch ( UnknownHostEx... | Returns all nodes known in the current config . | 113 | 9 |
42,616 | public static AsyncSearchQueryResult fromHttp429 ( String payload ) { SearchStatus status = new DefaultSearchStatus ( 1L , 1L , 0L ) ; SearchMetrics metrics = new DefaultSearchMetrics ( 0L , 0L , 0d ) ; return new DefaultAsyncSearchQueryResult ( status , Observable . < SearchQueryRow > error ( new FtsServerOverloadExce... | Creates a result out of the http 429 response code if retry didn t work . | 109 | 18 |
42,617 | @ Deprecated public static AsyncSearchQueryResult fromIndexNotFound ( final String indexName ) { //dummy default values SearchStatus status = new DefaultSearchStatus ( 1L , 1L , 0L ) ; SearchMetrics metrics = new DefaultSearchMetrics ( 0L , 0L , 0d ) ; return new DefaultAsyncSearchQueryResult ( status , Observable . < ... | A utility method to return a result when the index is not found . | 133 | 14 |
42,618 | private static String extractName ( final Field fieldReference ) { com . couchbase . client . java . repository . annotation . Field annotation = fieldReference . getAnnotation ( com . couchbase . client . java . repository . annotation . Field . class ) ; if ( annotation == null || annotation . value ( ) == null || an... | Helper method to extract the potentially aliased name of the field . | 100 | 13 |
42,619 | public byte [ ] rawContent ( String path ) { if ( path == null ) { return null ; } for ( SubdocOperationResult < OPERATION > result : resultList ) { if ( path . equals ( result . path ( ) ) ) { return interpretResultRaw ( result ) ; } } return null ; } | Attempt to get the serialized form of the value corresponding to the first operation that targeted the given path as an array of bytes . | 66 | 26 |
42,620 | public ResponseStatus status ( String path ) { if ( path == null ) { return null ; } for ( SubdocOperationResult < OPERATION > result : resultList ) { if ( path . equals ( result . path ( ) ) ) { return result . status ( ) ; } } return null ; } | Get the operation status code corresponding to the first operation that targeted the given path . | 63 | 16 |
42,621 | public boolean exists ( String path ) { if ( path == null ) { return false ; } for ( SubdocOperationResult < OPERATION > result : resultList ) { if ( path . equals ( result . path ( ) ) && ! ( result . value ( ) instanceof Exception ) ) { return true ; } } return false ; } | Checks whether the given path is part of this result set eg . an operation targeted it and the operation executed successfully . | 70 | 24 |
42,622 | public boolean exists ( int specIndex ) { return specIndex >= 0 && specIndex < resultList . size ( ) && ! ( resultList . get ( specIndex ) . value ( ) instanceof Exception ) ; } | Checks whether the given index is part of this result set and the operation was executed successfully . | 45 | 19 |
42,623 | private static boolean shouldRetry ( JsonObject errorJson ) { if ( errorJson == null ) return false ; Integer code = errorJson . getInt ( ERROR_FIELD_CODE ) ; String msg = errorJson . getString ( ERROR_FIELD_MSG ) ; if ( code == null || msg == null ) return false ; if ( code == 4050 || code == 4070 || ( code == 5000 &&... | Tests a N1QL error JSON for conditions warranting a prepared statement retry . | 119 | 18 |
42,624 | protected Observable < AsyncN1qlQueryResult > retryPrepareAndExecuteOnce ( Throwable error , N1qlQuery query , CouchbaseEnvironment env , long timeout , TimeUnit timeUnit ) { if ( error instanceof QueryExecutionException && shouldRetry ( ( ( QueryExecutionException ) error ) . getN1qlError ( ) ) ) { queryCache . remove... | In case the error warrants a retry issue a PREPARE followed by an update of the cache and an EXECUTE . Any failure in the EXECUTE won t continue the retry cycle . | 123 | 41 |
42,625 | protected Observable < AsyncN1qlQueryResult > prepareAndExecute ( final N1qlQuery query , final CouchbaseEnvironment env , final long timeout , final TimeUnit timeUnit ) { return prepare ( query . statement ( ) ) . flatMap ( new Func1 < PreparedPayload , Observable < AsyncN1qlQueryResult > > ( ) { @ Override public Obs... | Issues a N1QL PREPARE puts the plan in cache then EXECUTE it . | 144 | 20 |
42,626 | protected Observable < AsyncN1qlQueryResult > executePrepared ( final N1qlQuery query , PreparedPayload payload , CouchbaseEnvironment env , long timeout , TimeUnit timeUnit ) { PreparedN1qlQuery preparedQuery ; if ( query instanceof ParameterizedN1qlQuery ) { ParameterizedN1qlQuery pq = ( ParameterizedN1qlQuery ) quer... | Issues a proper N1QL EXECUTE detecting if parameters must be added to it . | 227 | 19 |
42,627 | private GenericQueryRequest createN1qlRequest ( final N1qlQuery query , String bucket , String username , String password , InetAddress targetNode ) { String rawQuery = query . n1ql ( ) . toString ( ) ; rawQuery = rawQuery . replaceAll ( CouchbaseAsyncBucket . CURRENT_BUCKET_IDENTIFIER , "`" + bucket + "`" ) ; String s... | Creates the core query request and performs centralized string substitution . | 181 | 12 |
42,628 | public static Expression replace ( Expression expression , String substring , String repl ) { return x ( "REPLACE(" + expression . toString ( ) + ", \"" + substring + "\", \"" + repl + "\")" ) ; } | Returned expression results in a string with all occurrences of substr replaced with repl . | 52 | 16 |
42,629 | public static Expression substr ( Expression expression , int position , int length ) { return x ( "SUBSTR(" + expression . toString ( ) + ", " + position + ", " + length + ")" ) ; } | Returned expression results in a substring from the integer position of the given length . | 46 | 17 |
42,630 | public static Expression ifMissing ( Expression expression1 , Expression expression2 , Expression ... others ) { return build ( "IFMISSING" , expression1 , expression2 , others ) ; } | Returned expression results in the first non - MISSING value . | 39 | 13 |
42,631 | public static Expression ifMissingOrNull ( Expression expression1 , Expression expression2 , Expression ... others ) { return build ( "IFMISSINGORNULL" , expression1 , expression2 , others ) ; } | Returned expression results in first non - NULL non - MISSING value . | 43 | 15 |
42,632 | public static Expression ifNull ( Expression expression1 , Expression expression2 , Expression ... others ) { return build ( "IFNULL" , expression1 , expression2 , others ) ; } | Returned expression results in first non - NULL value . Note that this function might return MISSING if there is no non - NULL value . | 37 | 28 |
42,633 | public static Expression missingIf ( Expression expression1 , Expression expression2 ) { return x ( "MISSINGIF(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ; } | Returned expression results in MISSING if expression1 = expression2 otherwise returns expression1 . Returns MISSING or NULL if either input is MISSING or NULL .. | 49 | 32 |
42,634 | public static Expression nullIf ( Expression expression1 , Expression expression2 ) { return x ( "NULLIF(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ; } | Returned expression results in NULL if expression1 = expression2 otherwise returns expression1 . Returns MISSING or NULL if either input is MISSING or NULL .. | 47 | 31 |
42,635 | public static Expression ifInf ( Expression expression1 , Expression expression2 , Expression ... others ) { return build ( "IFINF" , expression1 , expression2 , others ) ; } | Returned expression results in first non - MISSING non - Inf number . Returns MISSING or NULL if a non - number input is encountered first . | 38 | 30 |
42,636 | public static Expression ifNaN ( Expression expression1 , Expression expression2 , Expression ... others ) { return build ( "IFNAN" , expression1 , expression2 , others ) ; } | Returned expression results in first non - MISSING non - NaN number . Returns MISSING or NULL if a non - number input is encountered first | 39 | 30 |
42,637 | public static Expression ifNaNOrInf ( Expression expression1 , Expression expression2 , Expression ... others ) { return build ( "IFNANORINF" , expression1 , expression2 , others ) ; } | Returned expression results in first non - MISSING non - Inf or non - NaN number . Returns MISSING or NULL if a non - number input is encountered first . | 44 | 35 |
42,638 | public static Expression nanIf ( Expression expression1 , Expression expression2 ) { return x ( "NANIF(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ; } | Returned expression results in NaN if expression1 = expression2 otherwise returns expression1 . Returns MISSING or NULL if either input is MISSING or NULL . | 48 | 32 |
42,639 | public static Expression negInfIf ( Expression expression1 , Expression expression2 ) { return x ( "NEGINFIF(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ; } | Returned expression results in NegInf if expression1 = expression2 otherwise returns expression1 . Returns MISSING or NULL if either input is MISSING or NULL . | 50 | 32 |
42,640 | public static Expression posInfIf ( Expression expression1 , Expression expression2 ) { return x ( "POSINFIF(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ; } | Returned expression results in PosInf if expression1 = expression2 otherwise returns expression1 . Returns MISSING or NULL if either input is MISSING or NULL . | 50 | 32 |
42,641 | @ InterfaceStability . Experimental @ InterfaceAudience . Public public static < D extends Document < ? > > Single < D > getFirstPrimaryOrReplica ( final String id , final Class < D > target , final Bucket bucket , final long primaryTimeout , final long replicaTimeout ) { if ( primaryTimeout <= 0 ) { throw new IllegalA... | Asynchronously fetch the document from the primary and if that operations fails try all the replicas and return the first document that comes back from them . | 247 | 30 |
42,642 | public ViewQuery includeDocsOrdered ( boolean includeDocs , Class < ? extends Document < ? > > target ) { this . includeDocs = includeDocs ; this . retainOrder = includeDocs ; //deactivate if includeDocs is deactivated this . includeDocsTarget = target ; return this ; } | Proactively load the full document for the row returned while strictly retaining view row order . | 68 | 17 |
42,643 | public ViewQuery groupLevel ( final int grouplevel ) { params [ PARAM_GROUPLEVEL_OFFSET ] = "group_level" ; params [ PARAM_GROUPLEVEL_OFFSET + 1 ] = Integer . toString ( grouplevel ) ; return this ; } | Specify the group level to be used . | 63 | 9 |
42,644 | protected String encode ( final String source ) { try { return URLEncoder . encode ( source , "UTF-8" ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Could not prepare view argument: " + ex ) ; } } | Helper method to properly encode a string . | 54 | 8 |
42,645 | public static String digestSha1Hex ( String source ) { String sha1 = "" ; try { MessageDigest crypt = MessageDigest . getInstance ( "SHA-1" ) ; crypt . reset ( ) ; crypt . update ( source . getBytes ( "UTF-8" ) ) ; sha1 = byteToHex ( crypt . digest ( ) ) ; } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ... | Hashes the source with SHA1 and returns the resulting hash as an hexadecimal string . | 128 | 20 |
42,646 | public static List < String > fromDnsSrv ( final String serviceName , boolean full , boolean secure ) throws NamingException { return fromDnsSrv ( serviceName , full , secure , null ) ; } | Fetch a bootstrap list from DNS SRV using default OS name resolution . | 48 | 16 |
42,647 | public static List < String > fromDnsSrv ( final String serviceName , boolean full , boolean secure , String nameServerIP ) throws NamingException { String fullService ; if ( full ) { fullService = serviceName ; } else { fullService = ( secure ? DEFAULT_DNS_SECURE_SERVICE : DEFAULT_DNS_SERVICE ) + serviceName ; } DirCo... | Fetch a bootstrap list from DNS SRV using a specific nameserver IP . | 208 | 17 |
42,648 | static List < String > loadDnsRecords ( final String serviceName , final DirContext ctx ) throws NamingException { Attributes attrs = ctx . getAttributes ( serviceName , new String [ ] { "SRV" } ) ; NamingEnumeration < ? > servers = attrs . get ( "srv" ) . getAll ( ) ; List < String > records = new ArrayList < String >... | Helper method to load a list of DNS SRV records . | 142 | 12 |
42,649 | public static Expression millisToUtc ( String expression , String format ) { return millisToUtc ( x ( expression ) , format ) ; } | Returned expression results in the UTC string to which the UNIX time stamp has been converted in the supported format . | 32 | 23 |
42,650 | public static Expression nowStr ( String format ) { if ( format == null || format . isEmpty ( ) ) { return x ( "NOW_STR()" ) ; } return x ( "NOW_STR(\"" + format + "\")" ) ; } | Returned expression results in statement time stamp as a string in a supported format ; does not vary during a query . | 55 | 23 |
42,651 | private void addToken ( final MutationToken token ) { if ( token != null ) { ListIterator < MutationToken > tokenIterator = tokens . listIterator ( ) ; while ( tokenIterator . hasNext ( ) ) { MutationToken t = tokenIterator . next ( ) ; if ( t . vbucketID ( ) == token . vbucketID ( ) && t . bucket ( ) . equals ( token ... | Helper method to check the incoming token and store it if needed . | 134 | 13 |
42,652 | public RestApiResponse execute ( long timeout , TimeUnit timeUnit ) { return Blocking . blockForSingle ( delegate . execute ( ) , timeout , timeUnit ) ; } | Executes the API request in a synchronous fashion using the given timeout . | 37 | 15 |
42,653 | public DateRangeQuery start ( Date start , boolean inclusive ) { this . start = SearchUtils . toFtsUtcString ( start ) ; this . inclusiveStart = inclusive ; return this ; } | Sets the lower boundary of the range inclusive or not depending on the second parameter . | 42 | 17 |
42,654 | public DateRangeQuery start ( Date start ) { this . start = SearchUtils . toFtsUtcString ( start ) ; this . inclusiveStart = null ; return this ; } | Sets the lower boundary of the range . The lower boundary is considered inclusive by default on the server side . | 39 | 22 |
42,655 | public DateRangeQuery end ( Date end , boolean inclusive ) { this . end = SearchUtils . toFtsUtcString ( end ) ; this . inclusiveEnd = inclusive ; return this ; } | Sets the upper boundary of the range inclusive or not depending on the second parameter . | 42 | 17 |
42,656 | public DateRangeQuery end ( Date end ) { this . end = SearchUtils . toFtsUtcString ( end ) ; this . inclusiveEnd = null ; return this ; } | Sets the upper boundary of the range . The upper boundary is considered exclusive by default on the server side . | 39 | 22 |
42,657 | public static Expression power ( Expression expression1 , Expression expression2 ) { return x ( "POWER(" + expression1 . toString ( ) + ", " + expression2 . toString ( ) + ")" ) ; } | Returned expression results in expression1 to the power of expression2 . | 46 | 14 |
42,658 | public static Expression power ( Number value1 , Number value2 ) { return power ( x ( value1 ) , x ( value2 ) ) ; } | Returned expression results in value1 to the power of value2 . | 31 | 14 |
42,659 | static String formatTimeout ( final CouchbaseRequest request , final long timeout ) { Map < String , Object > fieldMap = new HashMap < String , Object > ( ) ; fieldMap . put ( "t" , timeout ) ; if ( request != null ) { fieldMap . put ( "s" , formatServiceType ( request ) ) ; putIfNotNull ( fieldMap , "i" , request . op... | This method take the given request and produces the correct additional timeout information according to the RFC . | 228 | 18 |
42,660 | private static String formatServiceType ( final CouchbaseRequest request ) { if ( request instanceof BinaryRequest ) { return ThresholdLogReporter . SERVICE_KV ; } else if ( request instanceof QueryRequest ) { return ThresholdLogReporter . SERVICE_N1QL ; } else if ( request instanceof ViewRequest ) { return ThresholdLo... | Helper method to turn the request into the proper string service type . | 171 | 13 |
42,661 | private Observable < BucketSettings > ensureBucketIsHealthy ( final Observable < BucketSettings > input ) { return input . flatMap ( new Func1 < BucketSettings , Observable < BucketSettings > > ( ) { @ Override public Observable < BucketSettings > call ( final BucketSettings bucketSettings ) { return info ( ) . delay (... | Helper method to ensure that the state of a bucket on all nodes is healthy . | 262 | 16 |
42,662 | public MutateInBuilder withDurability ( PersistTo persistTo , ReplicateTo replicateTo ) { asyncBuilder . withDurability ( persistTo , replicateTo ) ; return this ; } | Set both a persistence and replication durability constraints for the whole mutation . | 40 | 13 |
42,663 | public static Func1 < DocumentFragment < Mutation > , Boolean > getMapResultFnForSubdocMutationToBoolean ( ) { return new Func1 < DocumentFragment < Mutation > , Boolean > ( ) { @ Override public Boolean call ( DocumentFragment < Mutation > documentFragment ) { ResponseStatus status = documentFragment . status ( 0 ) ; ... | Creates anonymous function for mapping document fragment result to boolean | 120 | 11 |
42,664 | public static Func1 < JsonDocument , DocumentFragment < Mutation > > getMapFullDocResultToSubDocFn ( final Mutation mutation ) { return new Func1 < JsonDocument , DocumentFragment < Mutation > > ( ) { @ Override public DocumentFragment < Mutation > call ( JsonDocument document ) { return new DocumentFragment < Mutation... | Creates anonymous function for mapping full JsonDocument insert result to document fragment result | 138 | 16 |
42,665 | public static < E > DocumentFragment < Mutation > convertToSubDocumentResult ( ResponseStatus status , Mutation mutation , E element ) { return new DocumentFragment < Mutation > ( null , 0 , null , Collections . singletonList ( SubdocOperationResult . createResult ( null , mutation , status , element ) ) ) ; } | Useful for mapping exceptions of Multimutation or to be silent by mapping success to a valid subdocument result | 72 | 22 |
42,666 | public N1qlParams consistency ( ScanConsistency consistency ) { this . consistency = consistency ; if ( consistency == ScanConsistency . NOT_BOUNDED ) { this . scanWait = null ; } return this ; } | Sets scan consistency . | 49 | 5 |
42,667 | @ InterfaceStability . Uncommitted public N1qlParams rawParam ( String name , Object value ) { if ( this . rawParams == null ) { this . rawParams = new HashMap < String , Object > ( ) ; } if ( ! JsonValue . checkType ( value ) ) { throw new IllegalArgumentException ( "Only JSON types are supported." ) ; } rawParams . p... | Allows to specify an arbitrary raw N1QL param . | 99 | 11 |
42,668 | private static Observable < ViewQueryResponse > passThroughOrThrow ( final ViewQueryResponse response ) { final int responseCode = response . responseCode ( ) ; if ( responseCode == 200 ) { return Observable . just ( response ) ; } return response . error ( ) . map ( new Func1 < String , ViewQueryResponse > ( ) { @ Ove... | Helper method which decides if the response is good to pass through or needs to be retried . | 122 | 19 |
42,669 | private static boolean shouldRetry ( final int status , final String content ) { switch ( status ) { case 200 : return false ; case 404 : return analyse404Response ( content ) ; case 500 : return analyse500Response ( content ) ; case 300 : case 301 : case 302 : case 303 : case 307 : case 401 : case 408 : case 409 : cas... | Analyses status codes and checks if a retry needs to happen . | 132 | 14 |
42,670 | private static boolean analyse404Response ( final String content ) { if ( content . contains ( "\"reason\":\"missing\"" ) ) { return true ; } LOGGER . debug ( "Design document not found, error is {}" , content ) ; return false ; } | Analyses the content of a 404 response to see if it is legible for retry . | 56 | 19 |
42,671 | private static boolean analyse500Response ( final String content ) { if ( content . contains ( "error" ) && content . contains ( "{not_found, missing_named_view}" ) ) { LOGGER . debug ( "Design document not found, error is {}" , content ) ; return false ; } if ( content . contains ( "error" ) && content . contains ( "\... | Analyses the content of a 500 response to see if it is legible for retry . | 109 | 19 |
42,672 | private Bucket getCachedBucket ( final String name ) { Bucket cachedBucket = bucketCache . get ( name ) ; if ( cachedBucket != null ) { if ( cachedBucket . isClosed ( ) ) { LOGGER . debug ( "Not returning cached bucket \"{}\", because it is closed." , name ) ; bucketCache . remove ( name ) ; } else { LOGGER . debug ( "... | Helper method to get a bucket instead of opening it if it is cached already . | 115 | 16 |
42,673 | protected void writeToSerializedStream ( ObjectOutputStream stream ) throws IOException { stream . writeLong ( cas ) ; stream . writeInt ( expiry ) ; stream . writeUTF ( id ) ; stream . writeObject ( content ) ; stream . writeObject ( mutationToken ) ; } | Helper method to write the current document state to the output stream for serialization purposes . | 60 | 17 |
42,674 | @ SuppressWarnings ( "unchecked" ) protected void readFromSerializedStream ( final ObjectInputStream stream ) throws IOException , ClassNotFoundException { cas = stream . readLong ( ) ; expiry = stream . readInt ( ) ; id = stream . readUTF ( ) ; content = ( T ) stream . readObject ( ) ; mutationToken = ( MutationToken ... | Helper method to create the document from an object input stream used for serialization purposes . | 91 | 17 |
42,675 | public static View create ( String name , String map , String reduce ) { return new DefaultView ( name , map , reduce ) ; } | Create a new representation of a regular non - spatial view . | 28 | 12 |
42,676 | public static View create ( String name , String map ) { return new DefaultView ( name , map , null ) ; } | Create a new representation of a regular non - spatial view without reduce function . | 25 | 15 |
42,677 | public SearchQuery highlight ( HighlightStyle style , String ... fields ) { this . highlightStyle = style ; if ( fields != null && fields . length > 0 ) { highlightFields = fields ; } return this ; } | Configures the highlighting of matches in the response . | 46 | 10 |
42,678 | public SearchQuery consistentWith ( Document ... docs ) { this . consistency = null ; this . mutationState = MutationState . from ( docs ) ; return this ; } | Sets the consistency to consider for this FTS query to AT_PLUS and uses the mutation information from the given documents to parameterize the consistency . This replaces any consistency tuning previously set . | 35 | 39 |
42,679 | public SearchQuery consistentWith ( DocumentFragment ... fragments ) { this . consistency = null ; this . mutationState = MutationState . from ( fragments ) ; return this ; } | Sets the consistency to consider for this FTS query to AT_PLUS and uses the mutation information from the given document fragments to parameterize the consistency . This replaces any consistency tuning previously set . | 37 | 40 |
42,680 | public static SatisfiesBuilder anyIn ( String variable , Expression expression ) { return new SatisfiesBuilder ( x ( "ANY" ) , variable , expression , true ) ; } | Create an ANY comprehension with a first IN range . | 36 | 10 |
42,681 | public static SatisfiesBuilder anyAndEveryIn ( String variable , Expression expression ) { return new SatisfiesBuilder ( x ( "ANY AND EVERY" ) , variable , expression , true ) ; } | Create an ANY AND EVERY comprehension with a first IN range . | 40 | 12 |
42,682 | public static SatisfiesBuilder anyWithin ( String variable , Expression expression ) { return new SatisfiesBuilder ( x ( "ANY" ) , variable , expression , false ) ; } | Create an ANY comprehension with a first WITHIN range . | 36 | 11 |
42,683 | public static SatisfiesBuilder everyIn ( String variable , Expression expression ) { return new SatisfiesBuilder ( x ( "EVERY" ) , variable , expression , true ) ; } | Create an EVERY comprehension with a first IN range . | 38 | 10 |
42,684 | public static SatisfiesBuilder everyWithin ( String variable , Expression expression ) { return new SatisfiesBuilder ( x ( "EVERY" ) , variable , expression , false ) ; } | Create an EVERY comprehension with a first WITHIN range . | 38 | 11 |
42,685 | public static WhenBuilder arrayIn ( Expression arrayExpression , String variable , Expression expression ) { return new WhenBuilder ( x ( "ARRAY " + arrayExpression . toString ( ) + " FOR" ) , variable , expression , true ) ; } | Create an ARRAY comprehension with a first IN range . | 53 | 11 |
42,686 | public static WhenBuilder arrayWithin ( Expression arrayExpression , String variable , Expression expression ) { return new WhenBuilder ( x ( "ARRAY " + arrayExpression . toString ( ) + " FOR" ) , variable , expression , false ) ; } | Create an ARRAY comprehension with a first WITHIN range . | 53 | 12 |
42,687 | @ Override public D newDocument ( String id , int expiry , T content , long cas , MutationToken mutationToken ) { LOGGER . warn ( "This transcoder ({}) does not support mutation tokens - this method is a " + "stub and needs to be implemented on custom transcoders." , this . getClass ( ) . getSimpleName ( ) ) ; return n... | Default implementation for backwards compatibility . | 95 | 6 |
42,688 | public static Serializable deserialize ( final ByteBuf content ) throws Exception { byte [ ] serialized = new byte [ content . readableBytes ( ) ] ; content . getBytes ( 0 , serialized ) ; ByteArrayInputStream bis = new ByteArrayInputStream ( serialized ) ; ObjectInputStream is = new ObjectInputStream ( bis ) ; Seriali... | Takes the input content and deserializes it . | 109 | 11 |
42,689 | public static ByteBuf serialize ( final Serializable serializable ) throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ; ObjectOutputStream os = new ObjectOutputStream ( bos ) ; os . writeObject ( serializable ) ; byte [ ] serialized = bos . toByteArray ( ) ; os . close ( ) ; bos . close ( )... | Serializes the input into a ByteBuf . | 97 | 10 |
42,690 | public static ByteBuf encodeStringAsUtf8 ( String source ) { ByteBuf target = Unpooled . buffer ( source . length ( ) ) ; ByteBufUtil . writeUtf8 ( target , source ) ; return target ; } | Helper method to encode a String into UTF8 via fast - path methods . | 54 | 15 |
42,691 | public AsyncMutateInBuilder withDurability ( PersistTo persistTo , ReplicateTo replicateTo ) { this . persistTo = persistTo ; this . replicateTo = replicateTo ; return this ; } | Set both a persistence and a replication durability constraints for the whole mutation . | 44 | 14 |
42,692 | @ InterfaceStability . Committed public AsyncMutateInBuilder insertDocument ( boolean insertDocument ) { if ( this . upsertDocument && insertDocument ) { throw new IllegalArgumentException ( "Cannot set both upsertDocument and insertDocument to true" ) ; } this . insertDocument = insertDocument ; return this ; } | Set insertDocument to true if the document has to be created only if it does not exist | 70 | 18 |
42,693 | public < T > AsyncMutateInBuilder insert ( String path , T fragment , SubdocOptionsBuilder optionsBuilder ) { if ( StringUtil . isNullOrEmpty ( path ) ) { throw new IllegalArgumentException ( "Path must not be empty for insert" ) ; } this . mutationSpecs . add ( new MutationSpec ( Mutation . DICT_ADD , path , fragment ... | Insert a fragment provided the last element of the path doesn t exist . | 94 | 14 |
42,694 | @ InterfaceStability . Committed public AsyncMutateInBuilder upsert ( JsonObject content ) { this . mutationSpecs . add ( new MutationSpec ( Mutation . UPSERTDOC , "" , content ) ) ; return this ; } | Upsert a full JSON document . | 53 | 8 |
42,695 | protected Observable < DocumentFragment < Mutation > > doSingleMutate ( MutationSpec spec , long timeout , TimeUnit timeUnit ) { Observable < DocumentFragment < Mutation >> mutation ; switch ( spec . type ( ) ) { case DICT_UPSERT : mutation = doSingleMutate ( spec , DICT_UPSERT_FACTORY , DICT_UPSERT_EVALUATOR , timeout... | Single operation implementations | 410 | 3 |
42,696 | private < T > Observable < DocumentFragment < T > > subdocObserveMutation ( Observable < DocumentFragment < T > > mutation , final long timeout , final TimeUnit timeUnit ) { if ( persistTo == PersistTo . NONE && replicateTo == ReplicateTo . NONE ) { return mutation ; } return mutation . flatMap ( new Func1 < DocumentFr... | utility methods for mutations | 370 | 5 |
42,697 | private Span startTracing ( String spanName ) { if ( ! environment . operationTracingEnabled ( ) ) { return null ; } Scope scope = environment . tracer ( ) . buildSpan ( spanName ) . startActive ( false ) ; Span parent = scope . span ( ) ; scope . close ( ) ; return parent ; } | Helper method to start tracing and return the span . | 71 | 10 |
42,698 | private Action0 stopTracing ( final Span parent ) { return new Action0 ( ) { @ Override public void call ( ) { if ( parent != null ) { environment . tracer ( ) . scopeManager ( ) . activate ( parent , true ) . close ( ) ; } } } ; } | Helper method to stop tracing for the parent span given . | 63 | 11 |
42,699 | private static Observable < List < String > > createMarkerDocuments ( final ClusterFacade core , final String bucket ) { return Observable . from ( FLUSH_MARKERS ) . flatMap ( new Func1 < String , Observable < UpsertResponse > > ( ) { @ Override public Observable < UpsertResponse > call ( final String id ) { return def... | Helper method to create marker documents for each partition . | 306 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.