diff --git a/src/pkg/client/backend_http.go b/src/pkg/client/backend_http.go index f973cca..ca808eb 100644 --- a/src/pkg/client/backend_http.go +++ b/src/pkg/client/backend_http.go @@ -7,7 +7,7 @@ import ( ) type BackendHTTP struct { - config *DataroomClientConfig + config *DatagoConfig } func (b BackendHTTP) collectSamples(chanSampleMetadata chan dbSampleMetadata, chanSamples chan Sample, transform *ARAwareTransform) { diff --git a/src/pkg/client/client.go b/src/pkg/client/client.go index bf5ad61..e444e65 100644 --- a/src/pkg/client/client.go +++ b/src/pkg/client/client.go @@ -59,7 +59,7 @@ const ( // incoming: object storage ) -type DataroomClientConfig struct { +type DatagoConfig struct { Sources string SourceType DatagoSourceType RequireImages bool @@ -86,7 +86,7 @@ type DataroomClientConfig struct { PageSize int } -type DataroomClient struct { +type DatagoClient struct { concurrency int baseRequest http.Request @@ -138,8 +138,8 @@ type Backend interface { // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -func GetDefaultConfig() DataroomClientConfig { - return DataroomClientConfig{ +func GetDefaultConfig() DatagoConfig { + return DatagoConfig{ Sources: "", SourceType: SourceTypeDB, RequireImages: true, @@ -168,7 +168,7 @@ func GetDefaultConfig() DataroomClientConfig { } // Create a new Dataroom Client -func GetClient(config DataroomClientConfig) *DataroomClient { +func GetClient(config DatagoConfig) *DatagoClient { // Create the frontend and backend var frontend Frontend @@ -183,7 +183,7 @@ func GetClient(config DataroomClientConfig) *DataroomClient { } // Create the client - client := &DataroomClient{ + client := &DatagoClient{ concurrency: config.ConcurrentDownloads, chanPageResults: make(chan dbResponse, 2), chanSampleMetadata: make(chan dbSampleMetadata, config.PrefetchBufferSize), @@ -209,7 +209,7 @@ func GetClient(config DataroomClientConfig) *DataroomClient { } // Make sure that the client will be Stopped() upon destruction - runtime.SetFinalizer(client, func(r *DataroomClient) { + runtime.SetFinalizer(client, func(r *DatagoClient) { r.Stop() }) @@ -217,7 +217,7 @@ func GetClient(config DataroomClientConfig) *DataroomClient { } // Start the background downloads, make it ready to serve samples. Will grow the memory and CPU footprint -func (c *DataroomClient) Start() { +func (c *DatagoClient) Start() { if c.context == nil || c.cancel == nil { // Get a context and a cancel function to stop the background goroutines and gracefully handle // interruptions at during http round trips @@ -279,7 +279,7 @@ func (c *DataroomClient) Start() { } // Get a deserialized sample from the client -func (c *DataroomClient) GetSample() Sample { +func (c *DatagoClient) GetSample() Sample { if c.cancel == nil { fmt.Println("Dataroom client not started. Starting it on the first sample, this adds some initial latency") fmt.Println("Please consider starting the client in anticipation by calling .Start()") @@ -294,7 +294,7 @@ func (c *DataroomClient) GetSample() Sample { } // Stop the background downloads, will clear the memory and CPU footprint -func (c *DataroomClient) Stop() { +func (c *DatagoClient) Stop() { fmt.Println("Stopping the dataroom client") // Signal the coroutines that next round should be a stop @@ -321,7 +321,7 @@ func (c *DataroomClient) Stop() { // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Coroutines which will be running in the background -func (c *DataroomClient) asyncDispatch() { +func (c *DatagoClient) asyncDispatch() { // Break down the page results and maintain a list of individual items to be processed for { diff --git a/src/pkg/client/frontend_db.go b/src/pkg/client/frontend_db.go index 4455835..00df77c 100644 --- a/src/pkg/client/frontend_db.go +++ b/src/pkg/client/frontend_db.go @@ -55,7 +55,7 @@ type dbRequest struct { lacksLatents string } -func (c *DataroomClientConfig) getDbRequest() dbRequest { +func (c *DatagoConfig) getDbRequest() dbRequest { fields := "attributes,image_direct_url" if c.HasLatents != "" || c.HasMasks != "" { @@ -101,7 +101,7 @@ type datagoFrontendDB struct { baseRequest http.Request } -func newDatagoFrontendDB(config DataroomClientConfig) datagoFrontendDB { +func newDatagoFrontendDB(config DatagoConfig) datagoFrontendDB { // Define the base request once and for all request := config.getDbRequest() diff --git a/src/pkg/client/serdes.go b/src/pkg/client/serdes.go index 9c38637..5c22ce1 100644 --- a/src/pkg/client/serdes.go +++ b/src/pkg/client/serdes.go @@ -181,7 +181,7 @@ func fetchImage(client *http.Client, url string, retries int, transform *ARAware return nil, -1., err_report } -func fetchSample(config *DataroomClientConfig, http_client *http.Client, sample_result dbSampleMetadata, transform *ARAwareTransform) *Sample { +func fetchSample(config *DatagoConfig, http_client *http.Client, sample_result dbSampleMetadata, transform *ARAwareTransform) *Sample { // Per sample work: // - fetch the raw payloads // - deserialize / decode, depending on the types