How to read objects in Openstack Swift based on Object Metadata - openstack

I know that we can store metadata with each object in Swift using .addHeader("X-Object-Meta-{name}",value) on the request builder.
How can I get a list of objects for with a particular metadata?
Basically I'm looking for a quick, efficient way of searching objects in Openstack Swift using the object Metadata.

Related

Managing firebase instances in flutter app

I'm cleaning up a flutter app and learning to use the dart profiler.
In my initial analysis I noted that the developers have created FirebaseAuth.instace almost everywhere in the app wherever data is streamed or fetched. Does this affect the app/memory/performance in any tangible way?
Also, isn't it better to create a single instance of FirebaseAuth or others like Firestore and use provider/riverpod/bloc to pass that instance rather than invoke it everywhere individually?
Does this affect the app/memory/performance in any tangible way?
No.
Also, isn't it better to create a single instance of FirebaseAuth or others like Firestore and use provider/riverpod/bloc to pass that instance rather than invoke it everywhere individually?
No. Each returned instance is a singleton. There is only one actual instance per initialized app returned every time you call it.
It just doesn't matter much whether you "invoke" the instance or use a stored object from the call. Do whatever you prefer.

How to start a workflow and pass in it values from associations

I have a ready-made requester that contains the data of an already running workflow. I need to implement the copying of this workflow. That is, a new workflow must be created that will contain data from the requester, including properties and associations. Accordingly, I have 2 questions:
How can I transfer data from associations to a new workflow?
Will all the data be available in the execution of workflow at the startup? If not, then how can they be made available, for example, at the start of the workflow itself.
I already found several examples of how to run a workflow in Java, but there only properties were passed in the property collection, without associations.

Access Database from CorDapp using CordaService

Given your example:
https://github.com/corda/flow-db
I have a question.
Is it ok to create and store custom data within the Node database? Reading the Corda API Persistence section, I thought it could be used only to access the node database, and not to create new tables, etc. What would be a reasonable description of what can and what cannot be stored via CordaService?
It's totally OK to use Custom tables in Node. The ServiceHub actually provides you will a Connection Object. getServiceHub().jdbcSession(). As long as, you don't do some Update/Delete to the Nodes existing table you are fine. You can create any table you want and use it as per your need. As of now, corda doesn't expose JPA to map your tables to an Entity class. I guess you could see this feature in some future release.

hiding method from certain layers in project

I was looking through an old project and wanted to see if anyone had a suggestion on how to hide certain methods from being called by various layers. This was a 3 tier project, webapplication -> web service -> database
In the application there is a User object for example. When a User was being updated, the webapplication would create a User object and pass it to the webservice. The webservice would use the DataAccessLayer to save the User object to the database. After looking at this I was wondering if instead I should have made a Save method in the User class. This way the service and simply call the Save on the User object which would trigger the db update.
However doing it this way would expose the Save to be called from the webapplication as well, correct? Since the webapplication also has access to the same User object.
Is there anyway around this, or is it better to avoid this altogether?
There is a separation of concerns by keepeing the User object as object that only holds data with no logic in it. you better keep it separated for the following reasons:
As you stated, it is a bad practice since the Save' functionality will be exposed to other places/classes where it is irrelevant for them (This is an important for programming generally).
Modifying the service layer - I guess you are using WCF web service as you can transfer a .NET object (c#/VB) to the service via SOAP. If you put the saving logic in the 'User' object, you can't replace it another webservice that receives a simple textual data structures like JSON or XML or simply doesn't support .NET objects.
Modifying the data storage layer - If you want, for example, to store the data inside a different place like other database such as MongoDB, RavenDB, Redis or what ever you want, you will have to reimplement each class that responsible for updating the data. This is also relevant for Unit Testing and Mocking, making them more complicated to interrogate.

Making a Linq property optional while using in Webservice

I am using LINQ object in my webservice and consumed by iphone and android developers.
Now i have added some new fields in a table which in turn will be used linq object.
I want to know some way by which i can mark some linq properties as optional i.e. if iphone and android deve. doesnt pass that properties then no error will show up.
Thanks
Gaurav
First, it is not recommended to embed your LINQ objects directly in a web service. Create data objects specifically for the web service that captures the relevant parameters for each web service call. This will protect your service consumers from changes to the underlying data storage and allow you to more tightly control what is known to the consumers. You can then use the adapter pattern to convert objects in your web service to LINQ objects for submitting to database.
Secondly, regarding your question about optional parameters. With custom data objects, this will be easily done with nullable properties (for primitive types), or just null for object types. If you must use the LINQ objects, making the fields nullable in the database will also cause the properties to be nullable, and thus optional to service consumers.

Resources