-
Notifications
You must be signed in to change notification settings - Fork 335
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
[#3348] feat(core,server): Add the list operation of the user #4055
Changes from 11 commits
4ec29a7
4b333a7
92c3032
81cd6cb
15144d2
0e6b040
0a0d6b3
9d0821d
feaa46f
91ac43a
d371b97
93d7d38
1707153
ff1640f
fdc9133
1adae39
be337b3
5a03882
6cddd60
c2c5c22
7f5bf9b
882d70d
f246628
51f6b00
50170d1
162b64a
a3a7865
39e100d
154a64b
c74bf55
457172b
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,66 @@ | ||
/* | ||
* 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.gravitino.dto.responses; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.Preconditions; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.apache.gravitino.dto.authorization.UserDTO; | ||
|
||
/** Represents a response containing a list of users. */ | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode(callSuper = true) | ||
public class UserListResponse extends BaseResponse { | ||
|
||
@JsonProperty("users") | ||
private final UserDTO[] users; | ||
|
||
/** | ||
* Constructor for UserListResponse. | ||
* | ||
* @param users The array of users. | ||
*/ | ||
public UserListResponse(UserDTO[] users) { | ||
super(0); | ||
this.users = users; | ||
} | ||
|
||
/** | ||
* This is the constructor that is used by Jackson deserializer to create an instance of | ||
* UserListResponse. | ||
*/ | ||
public UserListResponse() { | ||
super(0); | ||
this.users = null; | ||
} | ||
|
||
/** | ||
* Validates the response data. | ||
* | ||
* @throws IllegalArgumentException if users are not set. | ||
*/ | ||
@Override | ||
public void validate() throws IllegalArgumentException { | ||
super.validate(); | ||
Preconditions.checkArgument(users != null, "users must not be null"); | ||
} | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,16 +55,39 @@ public interface EntityStore extends Closeable { | |
* <p>Note. Depends on the isolation levels provided by the underlying storage, the returned list | ||
* may not be consistent. | ||
* | ||
* @param namespace the namespace of the entities | ||
* @param <E> class of the entity | ||
* @param namespace the namespace of the entities | ||
* @param type the detailed type of the entity | ||
* @param entityType the general type of the entity | ||
* @throws IOException if the list operation fails | ||
* @return the list of entities | ||
* @throws IOException if the list operation fails | ||
*/ | ||
<E extends Entity & HasIdentifier> List<E> list( | ||
Namespace namespace, Class<E> type, EntityType entityType) throws IOException; | ||
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. What I mean is that these interface can be implemented like: default XX list(xxxx) {
return list(xx, xx, xx, Lists.emptyList)
} 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. Done. |
||
|
||
/** | ||
* List all the entities with the specified {@link org.apache.gravitino.Namespace}, and | ||
* deserialize them into the specified {@link Entity} object. | ||
* | ||
* <p>Note. Depends on the isolation levels provided by the underlying storage, the returned list | ||
* may not be consistent. | ||
* | ||
* @param <E> class of the entity | ||
* @param namespace the namespace of the entities | ||
* @param type the detailed type of the entity | ||
* @param entityType the general type of the entity | ||
* @param skippingFields Some fields may have a relatively high acquisition cost, EntityStore | ||
* provide an optional setting to avoid fetching these high-cost fields to improve the | ||
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. provides 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. OK. |
||
* performance. | ||
* @return the list of entities | ||
* @throws IOException if the list operation fails | ||
*/ | ||
default <E extends Entity & HasIdentifier> List<E> list( | ||
Namespace namespace, Class<E> type, EntityType entityType, List<Field> skippingFields) | ||
yuqi1129 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
throws IOException { | ||
throw new UnsupportedOperationException("Don't support to skip fields"); | ||
} | ||
|
||
/** | ||
* Check if the entity with the specified {@link org.apache.gravitino.NameIdentifier} exists. | ||
* | ||
|
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.
Also here.
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.
Added.