-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-895534: Add HTAP query context entries to cache
- Loading branch information
1 parent
190c9ca
commit 10f8fa6
Showing
8 changed files
with
115 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
package gosnowflake | ||
|
||
import "sync" | ||
|
||
type queryContextEntry struct { | ||
ID int `json:"id"` | ||
Timestamp int64 `json:"timestamp"` | ||
Priority int `json:"priority"` | ||
Context any `json:"context,omitempty"` | ||
} | ||
|
||
type queryContextCache struct { | ||
mutex *sync.Mutex | ||
entries []queryContextEntry | ||
} | ||
|
||
func (qcc *queryContextCache) init() *queryContextCache { | ||
qcc.mutex = &sync.Mutex{} | ||
return qcc | ||
} | ||
|
||
func (qcc *queryContextCache) addAll(qces []queryContextEntry) { | ||
qcc.mutex.Lock() | ||
defer qcc.mutex.Unlock() | ||
qcc.entries = append(qcc.entries, qces...) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters