P0 fixes: - ModelError.Is(): use exact matching instead of substring contains() - shouldClearStickySession: add context param for cancellation/tracing P1 fixes: - TODO stubs: return 501 Not Implemented errors - validateInstanceSignature: deduplicate to shared validateCodeSignature() - Error messages: standardize to English only - http.go: remove pseudo if-else with duplicate branches
18 lines
663 B
Go
18 lines
663 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// GeminiTokenCache stores short-lived access tokens and coordinates refresh to avoid stampedes.
|
|
type GeminiTokenCache interface {
|
|
// cacheKey should be stable for the token scope; for GeminiCli OAuth we primarily use project_id.
|
|
GetAccessToken(ctx context.Context, cacheKey string) (string, error)
|
|
SetAccessToken(ctx context.Context, cacheKey string, token string, ttl time.Duration) error
|
|
DeleteAccessToken(ctx context.Context, cacheKey string) error
|
|
|
|
AcquireRefreshLock(ctx context.Context, cacheKey string, ttl time.Duration) (bool, error)
|
|
ReleaseRefreshLock(ctx context.Context, cacheKey string) error
|
|
}
|