-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(system): support conditional write semantics
* introduce If-Modified-Since, If-Unmodified-Since, If-Version-Match * ConditionalWriteValidator added * MCP headers field added * SystemMetadata version field added * batchGet with If-Version-Match support
- Loading branch information
1 parent
623b6f9
commit a73f076
Showing
57 changed files
with
2,770 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
entity-registry/src/main/java/com/linkedin/metadata/aspect/EnvelopedSystemAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.linkedin.metadata.aspect; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.data.template.RecordTemplate; | ||
import com.linkedin.entity.EnvelopedAspect; | ||
import com.linkedin.metadata.models.AspectSpec; | ||
import com.linkedin.metadata.models.EntitySpec; | ||
import com.linkedin.mxe.SystemMetadata; | ||
import java.sql.Timestamp; | ||
import java.time.Instant; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import lombok.Getter; | ||
|
||
/** Delegate to restli class */ | ||
public class EnvelopedSystemAspect implements SystemAspect { | ||
|
||
public static SystemAspect of( | ||
@Nonnull Urn urn, @Nonnull EnvelopedAspect envelopedAspect, @Nonnull EntitySpec entitySpec) { | ||
return new EnvelopedSystemAspect(urn, envelopedAspect, entitySpec); | ||
} | ||
|
||
@Getter @Nonnull private final Urn urn; | ||
@Nonnull private final EnvelopedAspect envelopedAspect; | ||
@Getter @Nonnull private final EntitySpec entitySpec; | ||
@Getter @Nonnull private final AspectSpec aspectSpec; | ||
|
||
public EnvelopedSystemAspect( | ||
@Nonnull Urn urn, @Nonnull EnvelopedAspect envelopedAspect, @Nonnull EntitySpec entitySpec) { | ||
this.urn = urn; | ||
this.envelopedAspect = envelopedAspect; | ||
this.entitySpec = entitySpec; | ||
this.aspectSpec = this.entitySpec.getAspectSpec(envelopedAspect.getName()); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public RecordTemplate getRecordTemplate() { | ||
return envelopedAspect.getValue(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public SystemMetadata getSystemMetadata() { | ||
return envelopedAspect.getSystemMetadata(); | ||
} | ||
|
||
@Override | ||
public long getVersion() { | ||
return envelopedAspect.getVersion(); | ||
} | ||
|
||
@Override | ||
public Timestamp getCreatedOn() { | ||
return Timestamp.from(Instant.ofEpochMilli(envelopedAspect.getCreated().getTime())); | ||
} | ||
|
||
@Override | ||
public String getCreatedBy() { | ||
return envelopedAspect.getCreated().getActor().toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.