@@ -20,7 +20,7 @@ import (
2020 "sync"
2121 "time"
2222
23- "github.com/codeGROOVE-dev/ds9"
23+ "github.com/codeGROOVE-dev/ds9/pkg/datastore "
2424 "github.com/codeGROOVE-dev/gsm"
2525 "github.com/codeGROOVE-dev/prcost/pkg/cost"
2626 "github.com/codeGROOVE-dev/prcost/pkg/github"
@@ -117,7 +117,7 @@ type Server struct {
117117 prDataCacheMu sync.RWMutex
118118 calcResultCacheMu sync.RWMutex
119119 // DataStore client for persistent caching (nil if not enabled).
120- dsClient * ds9 .Client
120+ dsClient * datastore .Client
121121}
122122
123123// CalculateRequest represents a request to calculate PR costs.
@@ -236,7 +236,7 @@ func New() *Server {
236236
237237 // Initialize DataStore client if DATASTORE_DB is set (persistent caching across restarts).
238238 if dbID := os .Getenv ("DATASTORE_DB" ); dbID != "" {
239- dsClient , err := ds9 .NewClientWithDatabase (ctx , "" , dbID )
239+ dsClient , err := datastore .NewClientWithDatabase (ctx , "" , dbID )
240240 if err != nil {
241241 logger .WarnContext (ctx , "Failed to initialize DataStore client - persistent caching disabled" ,
242242 "database_id" , dbID , "error" , err )
@@ -374,11 +374,11 @@ func (s *Server) cachedPRQuery(ctx context.Context, key string) ([]github.PRSumm
374374 return nil , false
375375 }
376376
377- dsKey := ds9 .NameKey ("PRQueryCache" , key , nil )
377+ dsKey := datastore .NameKey ("PRQueryCache" , key , nil )
378378 var entity prQueryCacheEntity
379379 err := s .dsClient .Get (ctx , dsKey , & entity )
380380 if err != nil {
381- if ! errors .Is (err , ds9 .ErrNoSuchEntity ) {
381+ if ! errors .Is (err , datastore .ErrNoSuchEntity ) {
382382 s .logger .WarnContext (ctx , "DataStore cache read failed" , "key" , key , "error" , err )
383383 }
384384 return nil , false
@@ -452,7 +452,7 @@ func (s *Server) cachePRQuery(ctx context.Context, key string, prs []github.PRSu
452452 QueryKey : key ,
453453 }
454454
455- dsKey := ds9 .NameKey ("PRQueryCache" , key , nil )
455+ dsKey := datastore .NameKey ("PRQueryCache" , key , nil )
456456 if _ , err := s .dsClient .Put (ctx , dsKey , & entity ); err != nil {
457457 s .logger .WarnContext (ctx , "Failed to write PR query to DataStore" , "key" , key , "error" , err )
458458 return
@@ -482,11 +482,11 @@ func (s *Server) cachedPRData(ctx context.Context, key string) (cost.PRData, boo
482482 return cost.PRData {}, false
483483 }
484484
485- dsKey := ds9 .NameKey ("PRDataCache" , key , nil )
485+ dsKey := datastore .NameKey ("PRDataCache" , key , nil )
486486 var entity prDataCacheEntity
487487 err := s .dsClient .Get (ctx , dsKey , & entity )
488488 if err != nil {
489- if ! errors .Is (err , ds9 .ErrNoSuchEntity ) {
489+ if ! errors .Is (err , datastore .ErrNoSuchEntity ) {
490490 s .logger .WarnContext (ctx , "DataStore cache read failed" , "key" , key , "error" , err )
491491 }
492492 return cost.PRData {}, false
@@ -542,7 +542,7 @@ func (s *Server) cachePRData(ctx context.Context, key string, prData cost.PRData
542542 URL : key ,
543543 }
544544
545- dsKey := ds9 .NameKey ("PRDataCache" , key , nil )
545+ dsKey := datastore .NameKey ("PRDataCache" , key , nil )
546546 if _ , err := s .dsClient .Put (ctx , dsKey , & entity ); err != nil {
547547 s .logger .WarnContext (ctx , "Failed to write PR data to DataStore" , "key" , key , "error" , err )
548548 return
@@ -586,11 +586,11 @@ func (s *Server) cachedCalcResult(ctx context.Context, prURL string, cfg cost.Co
586586 return cost.Breakdown {}, false
587587 }
588588
589- dsKey := ds9 .NameKey ("CalcResultCache" , key , nil )
589+ dsKey := datastore .NameKey ("CalcResultCache" , key , nil )
590590 var entity calcResultCacheEntity
591591 err := s .dsClient .Get (ctx , dsKey , & entity )
592592 if err != nil {
593- if ! errors .Is (err , ds9 .ErrNoSuchEntity ) {
593+ if ! errors .Is (err , datastore .ErrNoSuchEntity ) {
594594 s .logger .WarnContext (ctx , "DataStore calc cache read failed" , "key" , key , "error" , err )
595595 }
596596 return cost.Breakdown {}, false
@@ -646,7 +646,7 @@ func (s *Server) cacheCalcResult(ctx context.Context, prURL string, cfg cost.Con
646646 ConfigKey : configHash (cfg ),
647647 }
648648
649- dsKey := ds9 .NameKey ("CalcResultCache" , key , nil )
649+ dsKey := datastore .NameKey ("CalcResultCache" , key , nil )
650650 if _ , err := s .dsClient .Put (ctx , dsKey , & entity ); err != nil {
651651 s .logger .WarnContext (ctx , "Failed to write calc result to DataStore" , "key" , key , "error" , err )
652652 return
0 commit comments