-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persistence Refactor POC #1011
base: main
Are you sure you want to change the base?
Persistence Refactor POC #1011
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.polaris.core.persistence.dao; | ||
|
||
public interface CatalogDao {} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.polaris.core.persistence.dao; | ||
|
||
import java.util.List; | ||
import org.apache.iceberg.catalog.Namespace; | ||
import org.apache.polaris.core.entity.NamespaceEntity; | ||
import org.apache.polaris.core.entity.PolarisEntity; | ||
import org.apache.polaris.core.entity.PolarisEntityCore; | ||
|
||
public interface NamespaceDao { | ||
void save(NamespaceEntity namespace, List<PolarisEntityCore> catalogPath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's a good idea to have operation definitions in the DAO. The DAO could just a The idea of DAO is to "map" business logic object to persistence object, I think it's a paradigm we should keep here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To be clear,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it makes sense. As said in previous comment, the DAO as storage operation definition can do the mapping but I think he should use only storage records (persistence entities) that can be converted to service entitiy. Seperation here is welcome. |
||
|
||
void update(NamespaceEntity namespace, List<PolarisEntityCore> catalogPath); | ||
|
||
NamespaceEntity get(String namespaceId); | ||
|
||
NamespaceEntity get(Namespace namespace); | ||
|
||
boolean delete(List<PolarisEntityCore> catalogPath, PolarisEntity leafEntity, boolean cleanup); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For persistence DAO, my idea was more to have concrete DAO definition to help the implementer with associated record. The DAO deals with storage operation using a
record
carriage (to avoid coupliing with entity).Something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. We should refactor the existing service entities instead of creating a new set of them as I said in the mailing list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flyrain you are right for DAO, my point is more for using entity in the DAO. I would rather use a record in the DAO to decouple from Entity: it will force us to decouple service and storage layers, and the record should be "obvious" for DAO implementer.