...

Source file src/solace.dev/go/messaging/pkg/solace/cache_request_outcome.go

Documentation: solace.dev/go/messaging/pkg/solace

     1  // pubsubplus-go-client
     2  //
     3  // Copyright 2025 Solace Corporation. All rights reserved.
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  // http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  
    17  package solace
    18  
    19  import "solace.dev/go/messaging/pkg/solace/message"
    20  
    21  // CacheRequestOutcome represents the outcome of a cache response. Refer to the doc string of each variant for more details.
    22  type CacheRequestOutcome int
    23  
    24  const (
    25  	// Ok indicates that the cache request succeeded, and returned cached messages
    26  	CacheRequestOutcomeOk CacheRequestOutcome = iota
    27  
    28  	// NoData indicates that the cache request succeeded, but that no cached messages were available to be returned
    29  	CacheRequestOutcomeNoData
    30  
    31  	// SuspectData indicates that the cache request succeeded, but that the returned cached messages came from a suspect cache.
    32  	CacheRequestOutcomeSuspectData
    33  
    34  	// Failed indicates that the cache request failed in some way.
    35  	// Refer to the 'error' associated with this outcome through the CacheResponse interface.
    36  	CacheRequestOutcomeFailed
    37  )
    38  
    39  // CacheResponse provides information about the response received from the cache.
    40  type CacheResponse interface {
    41  
    42  	// GetCacheRequestOutcome retrieves the cache request outcome for the cache response
    43  	GetCacheRequestOutcome() CacheRequestOutcome
    44  
    45  	// GetCacheRequestID retrieves the cache request ID that generated the cache response
    46  	GetCacheRequestID() message.CacheRequestID
    47  
    48  	// GetError retrieves the error field, will be nil if the cache request
    49  	// was successful, and will be not nil if a problem has occurred.
    50  	GetError() error
    51  }
    52